code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { protected String getArgumentValue(String arg, String[] args, ConsoleWrapper stdin, PrintStream stdout) { for (int i = 1; i < args.length; i++) { String key = args[i].split("=")[0]; if (key.equals(arg)) { return getValue(args[i]); } } return null; } }
public class class_name { protected String getArgumentValue(String arg, String[] args, ConsoleWrapper stdin, PrintStream stdout) { for (int i = 1; i < args.length; i++) { String key = args[i].split("=")[0]; if (key.equals(arg)) { return getValue(args[i]); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { private static boolean isValidDate(String date, Calendar out, String separator) { try { String[] dates = date.split(separator); out.set(Calendar.DATE, Integer.parseInt(dates[dates.length - 1])); out.set(Calendar.MONTH, Integer.parseInt(dates[dates.length - 2])); if (dates.length > 2) { out.set(Calendar.YEAR, Integer.parseInt(dates[dates.length - 3])); } } catch (Exception e) { try { out.set(Calendar.DATE, Integer.parseInt(date.substring(date.length() - 2, date.length()))); out.set(Calendar.MONTH, Integer.parseInt(date.substring(date.length() - 4, date.length() - 2)) - 1); if (date.length() > 4) { out.set(Calendar.YEAR, Integer.parseInt(date.substring(date.length() - 8, date.length() - 4)) - 1); } } catch (Exception e2) { return false; } } return true; } }
public class class_name { private static boolean isValidDate(String date, Calendar out, String separator) { try { String[] dates = date.split(separator); out.set(Calendar.DATE, Integer.parseInt(dates[dates.length - 1])); // depends on control dependency: [try], data = [none] out.set(Calendar.MONTH, Integer.parseInt(dates[dates.length - 2])); // depends on control dependency: [try], data = [none] if (dates.length > 2) { out.set(Calendar.YEAR, Integer.parseInt(dates[dates.length - 3])); // depends on control dependency: [if], data = [none] } } catch (Exception e) { try { out.set(Calendar.DATE, Integer.parseInt(date.substring(date.length() - 2, date.length()))); // depends on control dependency: [try], data = [none] out.set(Calendar.MONTH, Integer.parseInt(date.substring(date.length() - 4, date.length() - 2)) - 1); // depends on control dependency: [try], data = [none] if (date.length() > 4) { out.set(Calendar.YEAR, Integer.parseInt(date.substring(date.length() - 8, date.length() - 4)) - 1); // depends on control dependency: [if], data = [(date.length()] } } catch (Exception e2) { return false; } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] return true; } }
public class class_name { public static String join(final Object[] array, final String separator) { if (isEmpty(array)) { return ""; } StringBuffer stringBuffer = new StringBuffer(); boolean isFirstVisited = true; for (Object object : array) { if (isFirstVisited) { isFirstVisited = false; } else { stringBuffer.append(separator); } stringBuffer.append(ObjectUtils.toString(object)); } return stringBuffer.toString(); } }
public class class_name { public static String join(final Object[] array, final String separator) { if (isEmpty(array)) { return ""; // depends on control dependency: [if], data = [none] } StringBuffer stringBuffer = new StringBuffer(); boolean isFirstVisited = true; for (Object object : array) { if (isFirstVisited) { isFirstVisited = false; // depends on control dependency: [if], data = [none] } else { stringBuffer.append(separator); // depends on control dependency: [if], data = [none] } stringBuffer.append(ObjectUtils.toString(object)); // depends on control dependency: [for], data = [object] } return stringBuffer.toString(); } }
public class class_name { public Map<String, List<String>> revsDiff(final Map<String, List<String>> revisions) throws DocumentStoreException { Misc.checkState(this.isOpen(), "Database is closed"); Misc.checkNotNull(revisions, "Input revisions"); Misc.checkArgument(!revisions.isEmpty(), "revisions cannot be empty"); try { ValueListMap<String, String> missingRevs = new ValueListMap<String, String>(); // Break down by docId first to avoid potential rev ID clashes between doc IDs for (Map.Entry<String, List<String>> entry : revisions.entrySet()) { String docId = entry.getKey(); List<String> revs = entry.getValue(); // Partition into batches to avoid exceeding placeholder limit // The doc ID will use one placeholder, so use limit - 1 for the number of // revs for the remaining placeholders. List<List<String>> batches = CollectionUtils.partition(revs, SQLITE_QUERY_PLACEHOLDERS_LIMIT - 1); for (List<String> revsBatch : batches) { missingRevs.addValuesToKey(docId, get(queue.submit(new RevsDiffBatchCallable(docId, revsBatch)))); } } return missingRevs; } catch (ExecutionException e) { String message = "Failed to calculate difference in revisions"; logger.log(Level.SEVERE, message, e); throw new DocumentStoreException(message, e); } } }
public class class_name { public Map<String, List<String>> revsDiff(final Map<String, List<String>> revisions) throws DocumentStoreException { Misc.checkState(this.isOpen(), "Database is closed"); Misc.checkNotNull(revisions, "Input revisions"); Misc.checkArgument(!revisions.isEmpty(), "revisions cannot be empty"); try { ValueListMap<String, String> missingRevs = new ValueListMap<String, String>(); // Break down by docId first to avoid potential rev ID clashes between doc IDs for (Map.Entry<String, List<String>> entry : revisions.entrySet()) { String docId = entry.getKey(); List<String> revs = entry.getValue(); // Partition into batches to avoid exceeding placeholder limit // The doc ID will use one placeholder, so use limit - 1 for the number of // revs for the remaining placeholders. List<List<String>> batches = CollectionUtils.partition(revs, SQLITE_QUERY_PLACEHOLDERS_LIMIT - 1); for (List<String> revsBatch : batches) { missingRevs.addValuesToKey(docId, get(queue.submit(new RevsDiffBatchCallable(docId, revsBatch)))); // depends on control dependency: [for], data = [revsBatch] } } return missingRevs; } catch (ExecutionException e) { String message = "Failed to calculate difference in revisions"; logger.log(Level.SEVERE, message, e); throw new DocumentStoreException(message, e); } } }
public class class_name { public void hasFirstElement(@NullableDecl Object element) { if (actualAsNavigableSet().isEmpty()) { failWithActual("expected to have first element", element); return; } if (!Objects.equal(actualAsNavigableSet().first(), element)) { if (actualAsNavigableSet().contains(element)) { failWithoutActual( simpleFact( lenientFormat( "Not true that %s has first element <%s>. " + "It does contain this element, but the first element is <%s>", actualAsString(), element, actualAsNavigableSet().first()))); return; } failWithoutActual( simpleFact( lenientFormat( "Not true that %s has first element <%s>. " + "It does not contain this element, and the first element is <%s>", actualAsString(), element, actualAsNavigableSet().first()))); } } }
public class class_name { public void hasFirstElement(@NullableDecl Object element) { if (actualAsNavigableSet().isEmpty()) { failWithActual("expected to have first element", element); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (!Objects.equal(actualAsNavigableSet().first(), element)) { if (actualAsNavigableSet().contains(element)) { failWithoutActual( simpleFact( lenientFormat( "Not true that %s has first element <%s>. " + "It does contain this element, but the first element is <%s>", actualAsString(), element, actualAsNavigableSet().first()))); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } failWithoutActual( simpleFact( lenientFormat( "Not true that %s has first element <%s>. " + "It does not contain this element, and the first element is <%s>", actualAsString(), element, actualAsNavigableSet().first()))); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String toJsonStr(JSON json, int indentFactor) { if (null == json) { return null; } return json.toJSONString(indentFactor); } }
public class class_name { public static String toJsonStr(JSON json, int indentFactor) { if (null == json) { return null; // depends on control dependency: [if], data = [none] } return json.toJSONString(indentFactor); } }
public class class_name { @Nullable public static Templates getXSLTTemplates (@Nonnull final EEbInterfaceVersion eVersion) { final String sNamespaceURI = eVersion.getNamespaceURI (); final Templates ret = s_aRWLock.readLocked ( () -> s_aTemplates.get (sNamespaceURI)); if (ret != null) return ret; return s_aRWLock.writeLocked ( () -> { // Try again in write lock Templates ret2 = s_aTemplates.get (sNamespaceURI); if (ret2 == null) { // Definitely not present - init final IReadableResource aXSLTRes = eVersion.getXSLTResource (); ret2 = XMLTransformerFactory.newTemplates (aXSLTRes); if (ret2 == null) LOGGER.error ("Failed to parse XSLT template " + aXSLTRes); else if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Compiled XSLT template " + aXSLTRes); s_aTemplates.put (sNamespaceURI, ret2); } return ret2; }); } }
public class class_name { @Nullable public static Templates getXSLTTemplates (@Nonnull final EEbInterfaceVersion eVersion) { final String sNamespaceURI = eVersion.getNamespaceURI (); final Templates ret = s_aRWLock.readLocked ( () -> s_aTemplates.get (sNamespaceURI)); if (ret != null) return ret; return s_aRWLock.writeLocked ( () -> { // Try again in write lock Templates ret2 = s_aTemplates.get (sNamespaceURI); if (ret2 == null) { // Definitely not present - init final IReadableResource aXSLTRes = eVersion.getXSLTResource (); ret2 = XMLTransformerFactory.newTemplates (aXSLTRes); // depends on control dependency: [if], data = [none] if (ret2 == null) LOGGER.error ("Failed to parse XSLT template " + aXSLTRes); else if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Compiled XSLT template " + aXSLTRes); s_aTemplates.put (sNamespaceURI, ret2); // depends on control dependency: [if], data = [none] } return ret2; }); } }
public class class_name { @SuppressWarnings("unchecked") public void putAll(Map t) { // don't delegate to putAll since we want case handling from put for (Entry next : (Set<Entry>) t.entrySet()) { put(next.getKey(), next.getValue()); } } }
public class class_name { @SuppressWarnings("unchecked") public void putAll(Map t) { // don't delegate to putAll since we want case handling from put for (Entry next : (Set<Entry>) t.entrySet()) { put(next.getKey(), next.getValue()); // depends on control dependency: [for], data = [next] } } }
public class class_name { public static String randomChinese(int length) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < length; i++) { sb.append((char) random(firstChineseNum, lastChineseNum).intValue()); } return sb.toString(); } }
public class class_name { public static String randomChinese(int length) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < length; i++) { sb.append((char) random(firstChineseNum, lastChineseNum).intValue()); // depends on control dependency: [for], data = [none] } return sb.toString(); } }
public class class_name { private User getUserFromFile(File userFile) { if (userFile.isFile() && userFile.canRead()) { try (FileInputStream userFileIO = new FileInputStream(userFile);) { Properties userProps = new Properties(); userProps.load(userFileIO); return new User(userFile.getName(), userProps); } catch (IOException ex) { log.error(null, ex); } } return null; } }
public class class_name { private User getUserFromFile(File userFile) { if (userFile.isFile() && userFile.canRead()) { try (FileInputStream userFileIO = new FileInputStream(userFile);) { Properties userProps = new Properties(); userProps.load(userFileIO); return new User(userFile.getName(), userProps); } catch (IOException ex) { // depends on control dependency: [if], data = [none] log.error(null, ex); } } return null; } }
public class class_name { public void addEventManager(String clazz) { try { m_eventManager = (CmsEventManager)Class.forName(clazz).newInstance(); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key(Messages.INIT_EVENTMANAGER_CLASS_SUCCESS_1, m_eventManager)); } } catch (Throwable t) { LOG.error(Messages.get().getBundle().key(Messages.INIT_EVENTMANAGER_CLASS_INVALID_1, clazz), t); return; } } }
public class class_name { public void addEventManager(String clazz) { try { m_eventManager = (CmsEventManager)Class.forName(clazz).newInstance(); // depends on control dependency: [try], data = [none] if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key(Messages.INIT_EVENTMANAGER_CLASS_SUCCESS_1, m_eventManager)); // depends on control dependency: [if], data = [none] } } catch (Throwable t) { LOG.error(Messages.get().getBundle().key(Messages.INIT_EVENTMANAGER_CLASS_INVALID_1, clazz), t); return; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void createAssertions(WyilFile.Decl declaration, List<VerificationCondition> vcs, GlobalEnvironment environment) { // FIXME: should be logged somehow? for (int i = 0; i != vcs.size(); ++i) { VerificationCondition vc = vcs.get(i); // Build the actual verification condition WyalFile.Stmt.Block verificationCondition = buildVerificationCondition(declaration, environment, vc); // Determine enclosing source unit Decl.Unit unit = declaration.getAncestor(Decl.Unit.class); // FIXME: this is not ideal Path.ID id = Trie.fromString(unit.getName().toString().replaceAll("::", "/")); // Add generated verification condition as assertion WyalFile.Declaration.Assert assrt = new WyalFile.Declaration.Assert(verificationCondition, vc.description, id, WhileyFile.ContentType); allocate(assrt, vc.getSpan()); } } }
public class class_name { private void createAssertions(WyilFile.Decl declaration, List<VerificationCondition> vcs, GlobalEnvironment environment) { // FIXME: should be logged somehow? for (int i = 0; i != vcs.size(); ++i) { VerificationCondition vc = vcs.get(i); // Build the actual verification condition WyalFile.Stmt.Block verificationCondition = buildVerificationCondition(declaration, environment, vc); // Determine enclosing source unit Decl.Unit unit = declaration.getAncestor(Decl.Unit.class); // FIXME: this is not ideal Path.ID id = Trie.fromString(unit.getName().toString().replaceAll("::", "/")); // Add generated verification condition as assertion WyalFile.Declaration.Assert assrt = new WyalFile.Declaration.Assert(verificationCondition, vc.description, id, WhileyFile.ContentType); allocate(assrt, vc.getSpan()); // depends on control dependency: [for], data = [none] } } }
public class class_name { private boolean setValue(String key, String value, String personaIdentifier) { SQLiteDatabase db = getWritableDatabase(); // Create a new map of values, where column names are the keys ContentValues values = new ContentValues(); values.put(Contract.COLUMN_KEY, key); values.put(Contract.COLUMN_VALUE, value); values.put(Contract.COLUMN_PERSONA, personaIdentifier); // Insert the new row, returning the primary key value of the new row long newRowId; String nullHack = null; newRowId = db.insert(Contract.TABLE_PROFILE, nullHack, values); if (newRowId <= -1) { Log.e(TAG, "Failure on inserting key:" + key + " value:" + value); return false; } return true; } }
public class class_name { private boolean setValue(String key, String value, String personaIdentifier) { SQLiteDatabase db = getWritableDatabase(); // Create a new map of values, where column names are the keys ContentValues values = new ContentValues(); values.put(Contract.COLUMN_KEY, key); values.put(Contract.COLUMN_VALUE, value); values.put(Contract.COLUMN_PERSONA, personaIdentifier); // Insert the new row, returning the primary key value of the new row long newRowId; String nullHack = null; newRowId = db.insert(Contract.TABLE_PROFILE, nullHack, values); if (newRowId <= -1) { Log.e(TAG, "Failure on inserting key:" + key + " value:" + value); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public void marshall(DeleteRepositoryRequest deleteRepositoryRequest, ProtocolMarshaller protocolMarshaller) { if (deleteRepositoryRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteRepositoryRequest.getRegistryId(), REGISTRYID_BINDING); protocolMarshaller.marshall(deleteRepositoryRequest.getRepositoryName(), REPOSITORYNAME_BINDING); protocolMarshaller.marshall(deleteRepositoryRequest.getForce(), FORCE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteRepositoryRequest deleteRepositoryRequest, ProtocolMarshaller protocolMarshaller) { if (deleteRepositoryRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteRepositoryRequest.getRegistryId(), REGISTRYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteRepositoryRequest.getRepositoryName(), REPOSITORYNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteRepositoryRequest.getForce(), FORCE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void enforceTicketValidationAuthorizationFor(final HttpServletRequest request, final Service service, final Assertion assertion) { val authorizers = serviceValidateConfigurationContext.getValidationAuthorizers().getAuthorizers(); for (val a : authorizers) { try { a.authorize(request, service, assertion); } catch (final Exception e) { throw new UnauthorizedServiceTicketValidationException(service); } } } }
public class class_name { protected void enforceTicketValidationAuthorizationFor(final HttpServletRequest request, final Service service, final Assertion assertion) { val authorizers = serviceValidateConfigurationContext.getValidationAuthorizers().getAuthorizers(); for (val a : authorizers) { try { a.authorize(request, service, assertion); // depends on control dependency: [try], data = [none] } catch (final Exception e) { throw new UnauthorizedServiceTicketValidationException(service); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { @SuppressWarnings("deprecation") public void cleanup() { if (null == mImageView) { return; // cleanup already done } final ImageView imageView = mImageView.get(); if (null != imageView) { // Remove this as a global layout listener ViewTreeObserver observer = imageView.getViewTreeObserver(); if (null != observer && observer.isAlive()) { observer.removeGlobalOnLayoutListener(this); } // Remove the ImageView's reference to this imageView.setOnTouchListener(null); // make sure a pending fling runnable won't be run cancelFling(); } if (null != mGestureDetector) { mGestureDetector.setOnDoubleTapListener(null); } // Clear listeners too mMatrixChangeListener = null; mPhotoTapListener = null; mViewTapListener = null; // Finally, clear ImageView mImageView = null; } }
public class class_name { @SuppressWarnings("deprecation") public void cleanup() { if (null == mImageView) { return; // cleanup already done // depends on control dependency: [if], data = [none] } final ImageView imageView = mImageView.get(); if (null != imageView) { // Remove this as a global layout listener ViewTreeObserver observer = imageView.getViewTreeObserver(); if (null != observer && observer.isAlive()) { observer.removeGlobalOnLayoutListener(this); // depends on control dependency: [if], data = [none] } // Remove the ImageView's reference to this imageView.setOnTouchListener(null); // depends on control dependency: [if], data = [(null] // make sure a pending fling runnable won't be run cancelFling(); // depends on control dependency: [if], data = [none] } if (null != mGestureDetector) { mGestureDetector.setOnDoubleTapListener(null); // depends on control dependency: [if], data = [(null] } // Clear listeners too mMatrixChangeListener = null; mPhotoTapListener = null; mViewTapListener = null; // Finally, clear ImageView mImageView = null; } }
public class class_name { void copyLocales(final Set<String> targetLocales) { final CmsEntity entity = m_entityBackend.getEntity(m_entityId); CmsRpcAction<Void> action = new CmsRpcAction<Void>() { @Override public void execute() { start(200, true); getService().copyLocale(targetLocales, entity, this); } @Override protected void onResponse(Void result) { stop(false); } }; action.execute(); for (String targetLocale : targetLocales) { String targetId = getIdForLocale(targetLocale); if (!m_entityId.equals(targetId)) { if (m_registeredEntities.contains(targetId)) { unregistereEntity(targetId); } registerClonedEntity(m_entityId, targetId); m_registeredEntities.add(targetId); m_changedEntityIds.add(targetId); m_contentLocales.add(targetLocale); m_deletedEntities.remove(targetId); enableSave(); } } initLocaleSelect(); } }
public class class_name { void copyLocales(final Set<String> targetLocales) { final CmsEntity entity = m_entityBackend.getEntity(m_entityId); CmsRpcAction<Void> action = new CmsRpcAction<Void>() { @Override public void execute() { start(200, true); getService().copyLocale(targetLocales, entity, this); } @Override protected void onResponse(Void result) { stop(false); } }; action.execute(); for (String targetLocale : targetLocales) { String targetId = getIdForLocale(targetLocale); if (!m_entityId.equals(targetId)) { if (m_registeredEntities.contains(targetId)) { unregistereEntity(targetId); // depends on control dependency: [if], data = [none] } registerClonedEntity(m_entityId, targetId); // depends on control dependency: [if], data = [none] m_registeredEntities.add(targetId); // depends on control dependency: [if], data = [none] m_changedEntityIds.add(targetId); // depends on control dependency: [if], data = [none] m_contentLocales.add(targetLocale); // depends on control dependency: [if], data = [none] m_deletedEntities.remove(targetId); // depends on control dependency: [if], data = [none] enableSave(); // depends on control dependency: [if], data = [none] } } initLocaleSelect(); } }
public class class_name { public Decision<Flow<T>> getOrCreateDecision() { List<Node> nodeList = childNode.get("decision"); if (nodeList != null && nodeList.size() > 0) { return new DecisionImpl<Flow<T>>(this, "decision", childNode, nodeList.get(0)); } return createDecision(); } }
public class class_name { public Decision<Flow<T>> getOrCreateDecision() { List<Node> nodeList = childNode.get("decision"); if (nodeList != null && nodeList.size() > 0) { return new DecisionImpl<Flow<T>>(this, "decision", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createDecision(); } }
public class class_name { public boolean hasRoles(String... roleIdentifiers) { List<Role> requiredRoles = new ArrayList<>(); for (String roleIdentifier : roleIdentifiers) { requiredRoles.add(new Role(roleIdentifier)); } return roles.containsAll(requiredRoles); } }
public class class_name { public boolean hasRoles(String... roleIdentifiers) { List<Role> requiredRoles = new ArrayList<>(); for (String roleIdentifier : roleIdentifiers) { requiredRoles.add(new Role(roleIdentifier)); // depends on control dependency: [for], data = [roleIdentifier] } return roles.containsAll(requiredRoles); } }
public class class_name { public static Method findMethod(Class clazz, String methodName) { final List<Method> methods = getDeclaredMethodsRecursively(clazz).get(methodName); if (methods.isEmpty()) { throw new IllegalArgumentException(clazz.getName() + "::" + methodName + " not found"); } final List<Method> specificMethods; if (methods.size() > 1) { specificMethods = methods.stream().filter(m -> m.getReturnType() != Object.class).collect(Collectors.toList()); } else { specificMethods = methods; } if (specificMethods.size() != 1) { throw new IllegalArgumentException( clazz.getName() + "::" + methodName + " more then one method found, can not decide which one to use. " + methods ); } return specificMethods.get(0); } }
public class class_name { public static Method findMethod(Class clazz, String methodName) { final List<Method> methods = getDeclaredMethodsRecursively(clazz).get(methodName); if (methods.isEmpty()) { throw new IllegalArgumentException(clazz.getName() + "::" + methodName + " not found"); } final List<Method> specificMethods; if (methods.size() > 1) { specificMethods = methods.stream().filter(m -> m.getReturnType() != Object.class).collect(Collectors.toList()); // depends on control dependency: [if], data = [none] } else { specificMethods = methods; // depends on control dependency: [if], data = [none] } if (specificMethods.size() != 1) { throw new IllegalArgumentException( clazz.getName() + "::" + methodName + " more then one method found, can not decide which one to use. " + methods ); } return specificMethods.get(0); } }
public class class_name { private boolean handleRpmFile(String innerDir, String archiveFile) { boolean success = true; File rpmFile = new File(archiveFile); FileInputStream rpmFIS = null; try { rpmFIS = new FileInputStream(rpmFile.getPath()); } catch (FileNotFoundException e) { success = false; logger.warn("File not found: {}", archiveFile); } Format format = null; ReadableByteChannel channel = Channels.newChannel(rpmFIS); ReadableChannelWrapper channelWrapper = new ReadableChannelWrapper(channel); try { format = new org.redline_rpm.Scanner().run(channelWrapper); } catch (IOException e) { success = false; logger.warn("Error reading RPM file {}: {}", archiveFile, e.getCause()); } if (format != null) { Header header = format.getHeader(); FileOutputStream cpioOS = null; FileOutputStream cpioEntryOutputStream = null; CpioArchiveInputStream cpioIn = null; File cpioFile = null; try { // extract all .cpio file // get input stream according to payload compressor type InputStream inputStream; AbstractHeader.Entry pcEntry = header.getEntry(Header.HeaderTag.PAYLOADCOMPRESSOR); String[] pc = (String[]) pcEntry.getValues(); if (pc[0].equals(LZMA)) { try { inputStream = new LZMACompressorInputStream(rpmFIS); } catch (Exception e) { throw new IOException("Failed to load LZMA compression stream", e); } } else { inputStream = Util.openPayloadStream(header, rpmFIS); } cpioFile = new File(rpmFile.getPath() + CPIO); cpioOS = new FileOutputStream(cpioFile); IOUtils.copy(inputStream, cpioOS); // extract files from .cpio File extractDestination = new File(innerDir); extractDestination.mkdirs(); cpioIn = new CpioArchiveInputStream(new FileInputStream(cpioFile)); CpioArchiveEntry cpioEntry; while ((cpioEntry = (CpioArchiveEntry) cpioIn.getNextEntry()) != null) { String entryName = cpioEntry.getName(); String lowercaseName = entryName.toLowerCase(); File file = new File(extractDestination, getFileName(entryName)); cpioEntryOutputStream = new FileOutputStream(file); IOUtils.copy(cpioIn, cpioEntryOutputStream); String innerExtractionDir; if (lowercaseName.matches(TAR_EXTENSION_PATTERN)) { innerExtractionDir = innerDir + File.separator + entryName + this.randomString; unTar(file.getName(), innerExtractionDir, file.getPath()); } else if (lowercaseName.matches(ZIP_EXTENSION_PATTERN)) { innerExtractionDir = innerDir + File.separator + entryName + this.randomString; unZip(innerExtractionDir, file.getPath()); } // close closeResource(cpioEntryOutputStream); } } catch (IOException e) { logger.error("Error unpacking rpm file {}: {}", rpmFile.getName(), e.getMessage()); } finally { closeResource(cpioEntryOutputStream); closeResource(cpioIn); closeResource(cpioOS); deleteFile(cpioFile); } } return success; } }
public class class_name { private boolean handleRpmFile(String innerDir, String archiveFile) { boolean success = true; File rpmFile = new File(archiveFile); FileInputStream rpmFIS = null; try { rpmFIS = new FileInputStream(rpmFile.getPath()); // depends on control dependency: [try], data = [none] } catch (FileNotFoundException e) { success = false; logger.warn("File not found: {}", archiveFile); } // depends on control dependency: [catch], data = [none] Format format = null; ReadableByteChannel channel = Channels.newChannel(rpmFIS); ReadableChannelWrapper channelWrapper = new ReadableChannelWrapper(channel); try { format = new org.redline_rpm.Scanner().run(channelWrapper); // depends on control dependency: [try], data = [none] } catch (IOException e) { success = false; logger.warn("Error reading RPM file {}: {}", archiveFile, e.getCause()); } // depends on control dependency: [catch], data = [none] if (format != null) { Header header = format.getHeader(); FileOutputStream cpioOS = null; FileOutputStream cpioEntryOutputStream = null; CpioArchiveInputStream cpioIn = null; File cpioFile = null; try { // extract all .cpio file // get input stream according to payload compressor type InputStream inputStream; AbstractHeader.Entry pcEntry = header.getEntry(Header.HeaderTag.PAYLOADCOMPRESSOR); String[] pc = (String[]) pcEntry.getValues(); if (pc[0].equals(LZMA)) { try { inputStream = new LZMACompressorInputStream(rpmFIS); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new IOException("Failed to load LZMA compression stream", e); } // depends on control dependency: [catch], data = [none] } else { inputStream = Util.openPayloadStream(header, rpmFIS); // depends on control dependency: [if], data = [none] } cpioFile = new File(rpmFile.getPath() + CPIO); // depends on control dependency: [try], data = [none] cpioOS = new FileOutputStream(cpioFile); // depends on control dependency: [try], data = [none] IOUtils.copy(inputStream, cpioOS); // depends on control dependency: [try], data = [none] // extract files from .cpio File extractDestination = new File(innerDir); extractDestination.mkdirs(); // depends on control dependency: [try], data = [none] cpioIn = new CpioArchiveInputStream(new FileInputStream(cpioFile)); // depends on control dependency: [try], data = [none] CpioArchiveEntry cpioEntry; while ((cpioEntry = (CpioArchiveEntry) cpioIn.getNextEntry()) != null) { String entryName = cpioEntry.getName(); String lowercaseName = entryName.toLowerCase(); File file = new File(extractDestination, getFileName(entryName)); cpioEntryOutputStream = new FileOutputStream(file); // depends on control dependency: [while], data = [none] IOUtils.copy(cpioIn, cpioEntryOutputStream); // depends on control dependency: [while], data = [none] String innerExtractionDir; if (lowercaseName.matches(TAR_EXTENSION_PATTERN)) { innerExtractionDir = innerDir + File.separator + entryName + this.randomString; // depends on control dependency: [if], data = [none] unTar(file.getName(), innerExtractionDir, file.getPath()); // depends on control dependency: [if], data = [none] } else if (lowercaseName.matches(ZIP_EXTENSION_PATTERN)) { innerExtractionDir = innerDir + File.separator + entryName + this.randomString; // depends on control dependency: [if], data = [none] unZip(innerExtractionDir, file.getPath()); // depends on control dependency: [if], data = [none] } // close closeResource(cpioEntryOutputStream); // depends on control dependency: [while], data = [none] } } catch (IOException e) { logger.error("Error unpacking rpm file {}: {}", rpmFile.getName(), e.getMessage()); } finally { // depends on control dependency: [catch], data = [none] closeResource(cpioEntryOutputStream); closeResource(cpioIn); closeResource(cpioOS); deleteFile(cpioFile); } } return success; } }
public class class_name { public static void findClasspathOrder(final ClassLoader classLoader, final ClasspathOrder classpathOrder, final ScanSpec scanSpec, final LogNode log) { // type ClasspathManager final Object manager = ReflectionUtils.getFieldVal(classLoader, "manager", false); addClasspathEntries(manager, classLoader, classpathOrder, scanSpec, log); // type FragmentClasspath[] final Object fragments = ReflectionUtils.getFieldVal(manager, "fragments", false); if (fragments != null) { for (int f = 0, fragLength = Array.getLength(fragments); f < fragLength; f++) { // type FragmentClasspath final Object fragment = Array.get(fragments, f); addClasspathEntries(fragment, classLoader, classpathOrder, scanSpec, log); } } // Only read system bundles once (all bundles should give the same results for this). if (!alreadyReadSystemBundles) { // type BundleLoader final Object delegate = ReflectionUtils.getFieldVal(classLoader, "delegate", false); // type EquinoxContainer final Object container = ReflectionUtils.getFieldVal(delegate, "container", false); // type Storage final Object storage = ReflectionUtils.getFieldVal(container, "storage", false); // type ModuleContainer final Object moduleContainer = ReflectionUtils.getFieldVal(storage, "moduleContainer", false); // type ModuleDatabase final Object moduleDatabase = ReflectionUtils.getFieldVal(moduleContainer, "moduleDatabase", false); // type HashMap<Integer, EquinoxModule> final Object modulesById = ReflectionUtils.getFieldVal(moduleDatabase, "modulesById", false); // type EquinoxSystemModule (module 0 is always the system module) final Object module0 = ReflectionUtils.invokeMethod(modulesById, "get", Object.class, 0L, false); // type Bundle final Object bundle = ReflectionUtils.invokeMethod(module0, "getBundle", false); // type BundleContext final Object bundleContext = ReflectionUtils.invokeMethod(bundle, "getBundleContext", false); // type Bundle[] final Object bundles = ReflectionUtils.invokeMethod(bundleContext, "getBundles", false); if (bundles != null) { for (int i = 0, n = Array.getLength(bundles); i < n; i++) { // type EquinoxBundle final Object equinoxBundle = Array.get(bundles, i); // type EquinoxModule final Object module = ReflectionUtils.getFieldVal(equinoxBundle, "module", false); // type String String location = (String) ReflectionUtils.getFieldVal(module, "location", false); if (location != null) { final int fileIdx = location.indexOf("file:"); if (fileIdx >= 0) { location = location.substring(fileIdx); classpathOrder.addClasspathEntry(location, classLoader, scanSpec, log); } } } } alreadyReadSystemBundles = true; } } }
public class class_name { public static void findClasspathOrder(final ClassLoader classLoader, final ClasspathOrder classpathOrder, final ScanSpec scanSpec, final LogNode log) { // type ClasspathManager final Object manager = ReflectionUtils.getFieldVal(classLoader, "manager", false); addClasspathEntries(manager, classLoader, classpathOrder, scanSpec, log); // type FragmentClasspath[] final Object fragments = ReflectionUtils.getFieldVal(manager, "fragments", false); if (fragments != null) { for (int f = 0, fragLength = Array.getLength(fragments); f < fragLength; f++) { // type FragmentClasspath final Object fragment = Array.get(fragments, f); addClasspathEntries(fragment, classLoader, classpathOrder, scanSpec, log); // depends on control dependency: [for], data = [none] } } // Only read system bundles once (all bundles should give the same results for this). if (!alreadyReadSystemBundles) { // type BundleLoader final Object delegate = ReflectionUtils.getFieldVal(classLoader, "delegate", false); // type EquinoxContainer final Object container = ReflectionUtils.getFieldVal(delegate, "container", false); // type Storage final Object storage = ReflectionUtils.getFieldVal(container, "storage", false); // type ModuleContainer final Object moduleContainer = ReflectionUtils.getFieldVal(storage, "moduleContainer", false); // type ModuleDatabase final Object moduleDatabase = ReflectionUtils.getFieldVal(moduleContainer, "moduleDatabase", false); // type HashMap<Integer, EquinoxModule> final Object modulesById = ReflectionUtils.getFieldVal(moduleDatabase, "modulesById", false); // type EquinoxSystemModule (module 0 is always the system module) final Object module0 = ReflectionUtils.invokeMethod(modulesById, "get", Object.class, 0L, false); // type Bundle final Object bundle = ReflectionUtils.invokeMethod(module0, "getBundle", false); // type BundleContext final Object bundleContext = ReflectionUtils.invokeMethod(bundle, "getBundleContext", false); // type Bundle[] final Object bundles = ReflectionUtils.invokeMethod(bundleContext, "getBundles", false); if (bundles != null) { for (int i = 0, n = Array.getLength(bundles); i < n; i++) { // type EquinoxBundle final Object equinoxBundle = Array.get(bundles, i); // type EquinoxModule final Object module = ReflectionUtils.getFieldVal(equinoxBundle, "module", false); // type String String location = (String) ReflectionUtils.getFieldVal(module, "location", false); if (location != null) { final int fileIdx = location.indexOf("file:"); if (fileIdx >= 0) { location = location.substring(fileIdx); // depends on control dependency: [if], data = [(fileIdx] classpathOrder.addClasspathEntry(location, classLoader, scanSpec, log); // depends on control dependency: [if], data = [none] } } } } alreadyReadSystemBundles = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void main(String[] args) throws IOException { String s = doc(svg( 160, 200, rect(0, 0, 160, 200, "fill:red;") + svg(10, 10, 100, 100, rect(0, 0, 100, 100, "fill:orange; stroke:rgb(0,0,0);")) + line(20, 20, 100, 100, "stroke:black; stroke-width:2px;") + line(20, 100, 100, 20, "stroke:black; stroke-width:2px;") + text(10, 140, "font-family:verdana; font-size:20px; font-weight:bold;", "Hello world"))); File file = new File("demo.svg"); FileWriter w = null; try { w = new FileWriter(file); w.write(s); } finally { if (w != null) { w.close(); } } System.out.println(String.format("File written: %s", file.getAbsolutePath())); // optionally view the just created file if (args.length > 0 && args[0].equals("-view")) { if (!viewSVG(file)) { System.err.println("'-view' not supported on this platform"); } } } }
public class class_name { public static void main(String[] args) throws IOException { String s = doc(svg( 160, 200, rect(0, 0, 160, 200, "fill:red;") + svg(10, 10, 100, 100, rect(0, 0, 100, 100, "fill:orange; stroke:rgb(0,0,0);")) + line(20, 20, 100, 100, "stroke:black; stroke-width:2px;") + line(20, 100, 100, 20, "stroke:black; stroke-width:2px;") + text(10, 140, "font-family:verdana; font-size:20px; font-weight:bold;", "Hello world"))); File file = new File("demo.svg"); FileWriter w = null; try { w = new FileWriter(file); w.write(s); } finally { if (w != null) { w.close(); // depends on control dependency: [if], data = [none] } } System.out.println(String.format("File written: %s", file.getAbsolutePath())); // optionally view the just created file if (args.length > 0 && args[0].equals("-view")) { if (!viewSVG(file)) { System.err.println("'-view' not supported on this platform"); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(EnvironmentProperties environmentProperties, ProtocolMarshaller protocolMarshaller) { if (environmentProperties == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(environmentProperties.getPropertyGroups(), PROPERTYGROUPS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(EnvironmentProperties environmentProperties, ProtocolMarshaller protocolMarshaller) { if (environmentProperties == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(environmentProperties.getPropertyGroups(), PROPERTYGROUPS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean writeToFile(String defaultFilePath, String realFilePath) { try { Files.copy(Paths.get(defaultFilePath), Paths.get(realFilePath), StandardCopyOption.REPLACE_EXISTING); return true; } catch (IOException e) { error("Unable to write to copy Properties-File", e); return false; } } }
public class class_name { public boolean writeToFile(String defaultFilePath, String realFilePath) { try { Files.copy(Paths.get(defaultFilePath), Paths.get(realFilePath), StandardCopyOption.REPLACE_EXISTING); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (IOException e) { error("Unable to write to copy Properties-File", e); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void configureAtoms(IAtomContainer container) { for (int f = 0; f < container.getAtomCount(); f++) { configure(container.getAtom(f)); } } }
public class class_name { public void configureAtoms(IAtomContainer container) { for (int f = 0; f < container.getAtomCount(); f++) { configure(container.getAtom(f)); // depends on control dependency: [for], data = [f] } } }
public class class_name { static public int getBlockCrc(DataNode datanode, ReplicaToRead ri, int namespaceId, Block block) throws IOException { InputStream rawStreamIn = null; DataInputStream streamIn = null; try { int bytesPerCRC; int checksumSize; long crcPerBlock; rawStreamIn = BlockWithChecksumFileReader.getMetaDataInputStream( datanode.data, namespaceId, block); streamIn = new DataInputStream(new BufferedInputStream(rawStreamIn, FSConstants.BUFFER_SIZE)); final BlockMetadataHeader header = BlockMetadataHeader .readHeader(streamIn); final DataChecksum checksum = header.getChecksum(); if (checksum.getChecksumType() != DataChecksum.CHECKSUM_CRC32) { throw new IOException("File Checksum now is only supported for CRC32"); } bytesPerCRC = checksum.getBytesPerChecksum(); checksumSize = checksum.getChecksumSize(); crcPerBlock = (((BlockWithChecksumFileReader.MetaDataInputStream) rawStreamIn) .getLength() - BlockMetadataHeader.getHeaderSize()) / checksumSize; int blockCrc = 0; byte[] buffer = new byte[checksumSize]; for (int i = 0; i < crcPerBlock; i++) { IOUtils.readFully(streamIn, buffer, 0, buffer.length); int intChecksum = ((buffer[0] & 0xff) << 24) | ((buffer[1] & 0xff) << 16) | ((buffer[2] & 0xff) << 8) | ((buffer[3] & 0xff)); if (i == 0) { blockCrc = intChecksum; } else { int chunkLength; if (i != crcPerBlock - 1 || ri.getBytesVisible() % bytesPerCRC == 0) { chunkLength = bytesPerCRC; } else { chunkLength = (int) ri.getBytesVisible() % bytesPerCRC; } blockCrc = CrcConcat.concatCrc(blockCrc, intChecksum, chunkLength); } } return blockCrc; } finally { if (streamIn != null) { IOUtils.closeStream(streamIn); } if (rawStreamIn != null) { IOUtils.closeStream(rawStreamIn); } } } }
public class class_name { static public int getBlockCrc(DataNode datanode, ReplicaToRead ri, int namespaceId, Block block) throws IOException { InputStream rawStreamIn = null; DataInputStream streamIn = null; try { int bytesPerCRC; int checksumSize; long crcPerBlock; rawStreamIn = BlockWithChecksumFileReader.getMetaDataInputStream( datanode.data, namespaceId, block); streamIn = new DataInputStream(new BufferedInputStream(rawStreamIn, FSConstants.BUFFER_SIZE)); final BlockMetadataHeader header = BlockMetadataHeader .readHeader(streamIn); final DataChecksum checksum = header.getChecksum(); if (checksum.getChecksumType() != DataChecksum.CHECKSUM_CRC32) { throw new IOException("File Checksum now is only supported for CRC32"); } bytesPerCRC = checksum.getBytesPerChecksum(); checksumSize = checksum.getChecksumSize(); crcPerBlock = (((BlockWithChecksumFileReader.MetaDataInputStream) rawStreamIn) .getLength() - BlockMetadataHeader.getHeaderSize()) / checksumSize; int blockCrc = 0; byte[] buffer = new byte[checksumSize]; for (int i = 0; i < crcPerBlock; i++) { IOUtils.readFully(streamIn, buffer, 0, buffer.length); // depends on control dependency: [for], data = [none] int intChecksum = ((buffer[0] & 0xff) << 24) | ((buffer[1] & 0xff) << 16) | ((buffer[2] & 0xff) << 8) | ((buffer[3] & 0xff)); if (i == 0) { blockCrc = intChecksum; // depends on control dependency: [if], data = [none] } else { int chunkLength; if (i != crcPerBlock - 1 || ri.getBytesVisible() % bytesPerCRC == 0) { chunkLength = bytesPerCRC; // depends on control dependency: [if], data = [none] } else { chunkLength = (int) ri.getBytesVisible() % bytesPerCRC; // depends on control dependency: [if], data = [none] } blockCrc = CrcConcat.concatCrc(blockCrc, intChecksum, chunkLength); // depends on control dependency: [if], data = [none] } } return blockCrc; } finally { if (streamIn != null) { IOUtils.closeStream(streamIn); // depends on control dependency: [if], data = [(streamIn] } if (rawStreamIn != null) { IOUtils.closeStream(rawStreamIn); // depends on control dependency: [if], data = [(rawStreamIn] } } } }
public class class_name { @Override public BlogEntry next() { try { final ClientEntry entry = iterator.next(); if (entry instanceof ClientMediaEntry) { return new AtomResource(collection, (ClientMediaEntry) entry); } else { return new AtomEntry(collection, entry); } } catch (final Exception e) { LOG.error("An error occured while fetching entry", e); } return null; } }
public class class_name { @Override public BlogEntry next() { try { final ClientEntry entry = iterator.next(); if (entry instanceof ClientMediaEntry) { return new AtomResource(collection, (ClientMediaEntry) entry); // depends on control dependency: [if], data = [none] } else { return new AtomEntry(collection, entry); // depends on control dependency: [if], data = [none] } } catch (final Exception e) { LOG.error("An error occured while fetching entry", e); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { @Override public void filter(Filter filter) throws NoTestsRemainException { List<FrameworkMethod> filteredChildren = ParentRunnerSpy.getFilteredChildren(this); // Iterate over a clone so that we can safely mutate the original. for (FrameworkMethod child : new ArrayList<>(filteredChildren)) { if (!filter.shouldRun(describeChildPlain(child))) { filteredChildren.remove(child); } } if (filteredChildren.isEmpty()) { throw new NoTestsRemainException(); } } }
public class class_name { @Override public void filter(Filter filter) throws NoTestsRemainException { List<FrameworkMethod> filteredChildren = ParentRunnerSpy.getFilteredChildren(this); // Iterate over a clone so that we can safely mutate the original. for (FrameworkMethod child : new ArrayList<>(filteredChildren)) { if (!filter.shouldRun(describeChildPlain(child))) { filteredChildren.remove(child); // depends on control dependency: [if], data = [none] } } if (filteredChildren.isEmpty()) { throw new NoTestsRemainException(); } } }
public class class_name { @Override public long until(Temporal endExclusive, TemporalUnit unit) { LocalTime end = LocalTime.from(endExclusive); if (unit instanceof ChronoUnit) { long nanosUntil = end.toNanoOfDay() - toNanoOfDay(); // no overflow switch ((ChronoUnit) unit) { case NANOS: return nanosUntil; case MICROS: return nanosUntil / 1000; case MILLIS: return nanosUntil / 1000_000; case SECONDS: return nanosUntil / NANOS_PER_SECOND; case MINUTES: return nanosUntil / NANOS_PER_MINUTE; case HOURS: return nanosUntil / NANOS_PER_HOUR; case HALF_DAYS: return nanosUntil / (12 * NANOS_PER_HOUR); } throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.between(this, end); } }
public class class_name { @Override public long until(Temporal endExclusive, TemporalUnit unit) { LocalTime end = LocalTime.from(endExclusive); if (unit instanceof ChronoUnit) { long nanosUntil = end.toNanoOfDay() - toNanoOfDay(); // no overflow switch ((ChronoUnit) unit) { case NANOS: return nanosUntil; // depends on control dependency: [if], data = [none] case MICROS: return nanosUntil / 1000; // depends on control dependency: [if], data = [none] case MILLIS: return nanosUntil / 1000_000; // depends on control dependency: [if], data = [none] case SECONDS: return nanosUntil / NANOS_PER_SECOND; // depends on control dependency: [if], data = [none] case MINUTES: return nanosUntil / NANOS_PER_MINUTE; // depends on control dependency: [if], data = [none] case HOURS: return nanosUntil / NANOS_PER_HOUR; // depends on control dependency: [if], data = [none] case HALF_DAYS: return nanosUntil / (12 * NANOS_PER_HOUR); // depends on control dependency: [if], data = [none] } throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.between(this, end); } }
public class class_name { public void configInterceptor(Interceptors me) { // add excetion interceptor me.add(new ExceptionInterceptor()); if (this.getHttpPostMethod()) { me.add(new POST()); } // config others configMoreInterceptors(me); } }
public class class_name { public void configInterceptor(Interceptors me) { // add excetion interceptor me.add(new ExceptionInterceptor()); if (this.getHttpPostMethod()) { me.add(new POST()); // depends on control dependency: [if], data = [none] } // config others configMoreInterceptors(me); } }
public class class_name { @Override public final void hndCartChan(final Map<String, Object> pRqVs, final Cart pCart, final TaxDestination pTxRules) throws Exception { @SuppressWarnings("unchecked") List<Deliv> dlvMts = (List<Deliv>) pRqVs.get("dlvMts"); Deliv cdl = null; for (Deliv dl : dlvMts) { if (dl.getItsId().equals(pCart.getDeliv())) { cdl = dl; break; } } if (cdl == null) { throw new Exception("wrong delivering!"); } //it must be at least one item to add forced service: boolean crtEmpty = true; CartLn clFrc = null; CartLn clEm = null; for (CartLn cl : pCart.getItems()) { if (cl.getDisab()) { clEm = cl; } else if (!cl.getDisab() && cl.getForc()) { clFrc = cl; } else if (!cl.getDisab() && !cl.getForc()) { crtEmpty = false; } } if (clFrc == null && cdl.getFrcSr() == null || cdl.getApMt() == null) { return; } if (crtEmpty) { if (clFrc != null) { delLine(pRqVs, clFrc, pTxRules); } return; } int cartTot; AccSettings as = (AccSettings) pRqVs.get("accSet"); TradingSettings ts = (TradingSettings) pRqVs.get("tradSet"); BigDecimal ct = pCart.getTot(); if (clFrc != null && clFrc.getTot().compareTo(BigDecimal.ZERO) == 1) { ct = ct.subtract(clFrc.getTot()); } if (pCart.getExcRt().compareTo(BigDecimal.ONE) == 0) { cartTot = ct.intValue(); } else { cartTot = ct.divide(pCart.getExcRt(), as.getPricePrecision(), as.getRoundingMode()).intValue(); } if (cartTot >= cdl.getApMt()) { if (clFrc != null && clFrc.getTot().compareTo(BigDecimal.ZERO) == 1) { clFrc.setPrice(BigDecimal.ZERO); clFrc.setTot(BigDecimal.ZERO); clFrc.setTotTx(BigDecimal.ZERO); clFrc.setSubt(BigDecimal.ZERO); clFrc.setTxDsc(null); clFrc.setTxCat(null); this.srvOrm.updateEntity(pRqVs, clFrc); makeCartTotals(pRqVs, ts, clFrc, as, pTxRules); } } else { if (clFrc == null) { if (clEm == null) { clFrc = new CartLn(); clFrc.setIsNew(true); clFrc.setItsOwner(pCart); pCart.getItems().add(clFrc); } else { clFrc = clEm; } clFrc.setSel(null); clFrc.setForc(true); clFrc.setDisab(false); clFrc.setItTyp(EShopItemType.SERVICE); clFrc.setItId(cdl.getFrcSr().getItsId()); clFrc.setItsName(cdl.getFrcSr().getItsName()); clFrc.setUom(cdl.getFrcSr().getDefUnitOfMeasure()); clFrc.setAvQuan(BigDecimal.ONE); clFrc.setQuant(BigDecimal.ONE); clFrc.setUnStep(BigDecimal.ONE); makeCartLine(pRqVs, clFrc, as, ts, pTxRules, true, true); makeCartTotals(pRqVs, ts, clFrc, as, pTxRules); } else if (clFrc.getTot().compareTo(BigDecimal.ZERO) == 0) { makeCartLine(pRqVs, clFrc, as, ts, pTxRules, true, true); makeCartTotals(pRqVs, ts, clFrc, as, pTxRules); } } } }
public class class_name { @Override public final void hndCartChan(final Map<String, Object> pRqVs, final Cart pCart, final TaxDestination pTxRules) throws Exception { @SuppressWarnings("unchecked") List<Deliv> dlvMts = (List<Deliv>) pRqVs.get("dlvMts"); Deliv cdl = null; for (Deliv dl : dlvMts) { if (dl.getItsId().equals(pCart.getDeliv())) { cdl = dl; // depends on control dependency: [if], data = [none] break; } } if (cdl == null) { throw new Exception("wrong delivering!"); } //it must be at least one item to add forced service: boolean crtEmpty = true; CartLn clFrc = null; CartLn clEm = null; for (CartLn cl : pCart.getItems()) { if (cl.getDisab()) { clEm = cl; } else if (!cl.getDisab() && cl.getForc()) { clFrc = cl; } else if (!cl.getDisab() && !cl.getForc()) { crtEmpty = false; } } if (clFrc == null && cdl.getFrcSr() == null || cdl.getApMt() == null) { return; } if (crtEmpty) { if (clFrc != null) { delLine(pRqVs, clFrc, pTxRules); } return; } int cartTot; AccSettings as = (AccSettings) pRqVs.get("accSet"); TradingSettings ts = (TradingSettings) pRqVs.get("tradSet"); BigDecimal ct = pCart.getTot(); if (clFrc != null && clFrc.getTot().compareTo(BigDecimal.ZERO) == 1) { ct = ct.subtract(clFrc.getTot()); } if (pCart.getExcRt().compareTo(BigDecimal.ONE) == 0) { cartTot = ct.intValue(); } else { cartTot = ct.divide(pCart.getExcRt(), as.getPricePrecision(), as.getRoundingMode()).intValue(); } if (cartTot >= cdl.getApMt()) { if (clFrc != null && clFrc.getTot().compareTo(BigDecimal.ZERO) == 1) { clFrc.setPrice(BigDecimal.ZERO); clFrc.setTot(BigDecimal.ZERO); clFrc.setTotTx(BigDecimal.ZERO); clFrc.setSubt(BigDecimal.ZERO); clFrc.setTxDsc(null); clFrc.setTxCat(null); this.srvOrm.updateEntity(pRqVs, clFrc); makeCartTotals(pRqVs, ts, clFrc, as, pTxRules); } } else { if (clFrc == null) { if (clEm == null) { clFrc = new CartLn(); clFrc.setIsNew(true); clFrc.setItsOwner(pCart); pCart.getItems().add(clFrc); } else { clFrc = clEm; } clFrc.setSel(null); clFrc.setForc(true); clFrc.setDisab(false); clFrc.setItTyp(EShopItemType.SERVICE); clFrc.setItId(cdl.getFrcSr().getItsId()); clFrc.setItsName(cdl.getFrcSr().getItsName()); clFrc.setUom(cdl.getFrcSr().getDefUnitOfMeasure()); clFrc.setAvQuan(BigDecimal.ONE); clFrc.setQuant(BigDecimal.ONE); clFrc.setUnStep(BigDecimal.ONE); makeCartLine(pRqVs, clFrc, as, ts, pTxRules, true, true); makeCartTotals(pRqVs, ts, clFrc, as, pTxRules); } else if (clFrc.getTot().compareTo(BigDecimal.ZERO) == 0) { makeCartLine(pRqVs, clFrc, as, ts, pTxRules, true, true); makeCartTotals(pRqVs, ts, clFrc, as, pTxRules); } } } }
public class class_name { protected Map<String, String> getElementAttributes() { // Preserve order of attributes Map<String, String> attrs = new HashMap<>(); if (this.getAlphabet() != null) { attrs.put("alphabet", this.getAlphabet().toString()); } if (this.getPh() != null) { attrs.put("ph", this.getPh()); } return attrs; } }
public class class_name { protected Map<String, String> getElementAttributes() { // Preserve order of attributes Map<String, String> attrs = new HashMap<>(); if (this.getAlphabet() != null) { attrs.put("alphabet", this.getAlphabet().toString()); // depends on control dependency: [if], data = [none] } if (this.getPh() != null) { attrs.put("ph", this.getPh()); // depends on control dependency: [if], data = [none] } return attrs; } }
public class class_name { public static MetadataTemplate getMetadataTemplate( BoxAPIConnection api, String templateName, String scope, String ... fields) { QueryStringBuilder builder = new QueryStringBuilder(); if (fields.length > 0) { builder.appendParam("fields", fields); } URL url = METADATA_TEMPLATE_URL_TEMPLATE.buildWithQuery( api.getBaseURL(), builder.toString(), scope, templateName); BoxAPIRequest request = new BoxAPIRequest(api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); return new MetadataTemplate(response.getJSON()); } }
public class class_name { public static MetadataTemplate getMetadataTemplate( BoxAPIConnection api, String templateName, String scope, String ... fields) { QueryStringBuilder builder = new QueryStringBuilder(); if (fields.length > 0) { builder.appendParam("fields", fields); // depends on control dependency: [if], data = [none] } URL url = METADATA_TEMPLATE_URL_TEMPLATE.buildWithQuery( api.getBaseURL(), builder.toString(), scope, templateName); BoxAPIRequest request = new BoxAPIRequest(api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); return new MetadataTemplate(response.getJSON()); } }
public class class_name { protected void postEvent2C(final Object event) { if (eventBus2C != null) { eventBus2C.post(event); } else { logger.warn("Trying to post event {} to EventBusC which is null", event.getClass().getName()); } } }
public class class_name { protected void postEvent2C(final Object event) { if (eventBus2C != null) { eventBus2C.post(event); // depends on control dependency: [if], data = [none] } else { logger.warn("Trying to post event {} to EventBusC which is null", event.getClass().getName()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Set<Integer> removeConnections(String endpointId) { Set<Integer> removed = this.entries.removeAll(endpointId); if (!removed.isEmpty() && log.isDebugEnabled()) { log.debug("Call " + getCallIdHex() + " unregistered connections " + Arrays.toString(convertToHex(removed)) + " from endpoint " + endpointId); } return removed; } }
public class class_name { public Set<Integer> removeConnections(String endpointId) { Set<Integer> removed = this.entries.removeAll(endpointId); if (!removed.isEmpty() && log.isDebugEnabled()) { log.debug("Call " + getCallIdHex() + " unregistered connections " + Arrays.toString(convertToHex(removed)) + " from endpoint " + endpointId); // depends on control dependency: [if], data = [none] } return removed; } }
public class class_name { private static SubclassType typeofClassDefiningName(Node callName) { // Check if the method name matches one of the class-defining methods. String methodName = null; if (callName.isGetProp()) { methodName = callName.getLastChild().getString(); } else if (callName.isName()) { String name = callName.getString(); int dollarIndex = name.lastIndexOf('$'); if (dollarIndex != -1) { methodName = name.substring(dollarIndex + 1); } } if (methodName != null) { if (methodName.equals("inherits")) { return SubclassType.INHERITS; } else if (methodName.equals("mixin")) { return SubclassType.MIXIN; } } return null; } }
public class class_name { private static SubclassType typeofClassDefiningName(Node callName) { // Check if the method name matches one of the class-defining methods. String methodName = null; if (callName.isGetProp()) { methodName = callName.getLastChild().getString(); // depends on control dependency: [if], data = [none] } else if (callName.isName()) { String name = callName.getString(); int dollarIndex = name.lastIndexOf('$'); if (dollarIndex != -1) { methodName = name.substring(dollarIndex + 1); // depends on control dependency: [if], data = [(dollarIndex] } } if (methodName != null) { if (methodName.equals("inherits")) { return SubclassType.INHERITS; // depends on control dependency: [if], data = [none] } else if (methodName.equals("mixin")) { return SubclassType.MIXIN; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { private final void computeGregorianAndDOWFields(int julianDay) { computeGregorianFields(julianDay); // Compute day of week: JD 0 = Monday int dow = fields[DAY_OF_WEEK] = julianDayToDayOfWeek(julianDay); // Calculate 1-based localized day of week int dowLocal = dow - getFirstDayOfWeek() + 1; if (dowLocal < 1) { dowLocal += 7; } fields[DOW_LOCAL] = dowLocal; } }
public class class_name { private final void computeGregorianAndDOWFields(int julianDay) { computeGregorianFields(julianDay); // Compute day of week: JD 0 = Monday int dow = fields[DAY_OF_WEEK] = julianDayToDayOfWeek(julianDay); // Calculate 1-based localized day of week int dowLocal = dow - getFirstDayOfWeek() + 1; if (dowLocal < 1) { dowLocal += 7; // depends on control dependency: [if], data = [none] } fields[DOW_LOCAL] = dowLocal; } }
public class class_name { private void findUsesSoftwareSystemsAnnotations(Component component, String typeName) { try { Class<?> type = getTypeRepository().loadClass(typeName); UsesSoftwareSystem[] annotations = type.getAnnotationsByType(UsesSoftwareSystem.class); for (UsesSoftwareSystem annotation : annotations) { String name = annotation.name(); String description = annotation.description(); String technology = annotation.technology(); SoftwareSystem softwareSystem = component.getModel().getSoftwareSystemWithName(name); if (softwareSystem != null) { component.uses(softwareSystem, description, technology); } else { log.warn("A software system named \"" + name + "\" could not be found."); } } } catch (ClassNotFoundException e) { log.warn("Could not load type " + typeName); } } }
public class class_name { private void findUsesSoftwareSystemsAnnotations(Component component, String typeName) { try { Class<?> type = getTypeRepository().loadClass(typeName); UsesSoftwareSystem[] annotations = type.getAnnotationsByType(UsesSoftwareSystem.class); for (UsesSoftwareSystem annotation : annotations) { String name = annotation.name(); String description = annotation.description(); String technology = annotation.technology(); SoftwareSystem softwareSystem = component.getModel().getSoftwareSystemWithName(name); if (softwareSystem != null) { component.uses(softwareSystem, description, technology); // depends on control dependency: [if], data = [(softwareSystem] } else { log.warn("A software system named \"" + name + "\" could not be found."); // depends on control dependency: [if], data = [none] } } } catch (ClassNotFoundException e) { log.warn("Could not load type " + typeName); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public ExecutionImpl createExecution(boolean initializeExecutionStartContext) { // create the new child execution ExecutionImpl createdExecution = newExecution(); // initialize sequence counter createdExecution.setSequenceCounter(getSequenceCounter()); // manage the bidirectional parent-child relation createdExecution.setParent(this); // initialize the new execution createdExecution.setProcessDefinition(getProcessDefinition()); createdExecution.setProcessInstance(getProcessInstance()); createdExecution.setActivity(getActivity()); // make created execution start in same activity instance createdExecution.activityInstanceId = activityInstanceId; // with the fix of CAM-9249 we presume that the parent and the child have the same startContext if (initializeExecutionStartContext) { createdExecution.setStartContext(new ExecutionStartContext()); } else if (startContext != null) { createdExecution.setStartContext(startContext); } createdExecution.skipCustomListeners = this.skipCustomListeners; createdExecution.skipIoMapping = this.skipIoMapping; return createdExecution; } }
public class class_name { public ExecutionImpl createExecution(boolean initializeExecutionStartContext) { // create the new child execution ExecutionImpl createdExecution = newExecution(); // initialize sequence counter createdExecution.setSequenceCounter(getSequenceCounter()); // manage the bidirectional parent-child relation createdExecution.setParent(this); // initialize the new execution createdExecution.setProcessDefinition(getProcessDefinition()); createdExecution.setProcessInstance(getProcessInstance()); createdExecution.setActivity(getActivity()); // make created execution start in same activity instance createdExecution.activityInstanceId = activityInstanceId; // with the fix of CAM-9249 we presume that the parent and the child have the same startContext if (initializeExecutionStartContext) { createdExecution.setStartContext(new ExecutionStartContext()); // depends on control dependency: [if], data = [none] } else if (startContext != null) { createdExecution.setStartContext(startContext); // depends on control dependency: [if], data = [(startContext] } createdExecution.skipCustomListeners = this.skipCustomListeners; createdExecution.skipIoMapping = this.skipIoMapping; return createdExecution; } }
public class class_name { public void marshall(Snapshot snapshot, ProtocolMarshaller protocolMarshaller) { if (snapshot == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(snapshot.getDirectoryId(), DIRECTORYID_BINDING); protocolMarshaller.marshall(snapshot.getSnapshotId(), SNAPSHOTID_BINDING); protocolMarshaller.marshall(snapshot.getType(), TYPE_BINDING); protocolMarshaller.marshall(snapshot.getName(), NAME_BINDING); protocolMarshaller.marshall(snapshot.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(snapshot.getStartTime(), STARTTIME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Snapshot snapshot, ProtocolMarshaller protocolMarshaller) { if (snapshot == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(snapshot.getDirectoryId(), DIRECTORYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(snapshot.getSnapshotId(), SNAPSHOTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(snapshot.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(snapshot.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(snapshot.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(snapshot.getStartTime(), STARTTIME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String getServletPath(Task task, String strServletParam) { String strServletName = null; if (strServletParam == null) strServletParam = Params.SERVLET; if (task != null) strServletName = task.getProperty(strServletParam); if ((strServletName == null) || (strServletName.length() == 0)) { strServletName = Constants.DEFAULT_SERVLET; //? if (this.getTask() instanceof RemoteRecordOwner) //? strServletName = strServletName + "xsl"; // Special case - if task is a session, servlet should be appxsl if (Params.XHTMLSERVLET.equalsIgnoreCase(strServletParam)) strServletName = Constants.DEFAULT_XHTML_SERVLET; } return strServletName; } }
public class class_name { public static String getServletPath(Task task, String strServletParam) { String strServletName = null; if (strServletParam == null) strServletParam = Params.SERVLET; if (task != null) strServletName = task.getProperty(strServletParam); if ((strServletName == null) || (strServletName.length() == 0)) { strServletName = Constants.DEFAULT_SERVLET; // depends on control dependency: [if], data = [none] //? if (this.getTask() instanceof RemoteRecordOwner) //? strServletName = strServletName + "xsl"; // Special case - if task is a session, servlet should be appxsl if (Params.XHTMLSERVLET.equalsIgnoreCase(strServletParam)) strServletName = Constants.DEFAULT_XHTML_SERVLET; } return strServletName; } }
public class class_name { private Attributes getAttributes(StartElement event) { AttributesImpl attrs = new AttributesImpl(); if (!event.isStartElement()) { throw new InternalError("getAttributes() attempting to process: " + event); } // Add namspace declarations if required if (this.filter.getNamespacePrefixes()) { for (@SuppressWarnings("unchecked") Iterator<Namespace> i = event.getNamespaces(); i.hasNext();) { Namespace staxNamespace = i.next(); String uri = staxNamespace.getNamespaceURI(); if (uri == null) { uri = ""; } String prefix = staxNamespace.getPrefix(); if (prefix == null) { prefix = ""; } String qName = "xmlns"; if (prefix.length() == 0) { prefix = qName; } else { qName = qName + ':' + prefix; } attrs.addAttribute("http://www.w3.org/2000/xmlns/", prefix, qName, "CDATA", uri); } } // gather non-namespace attrs for (@SuppressWarnings("unchecked") Iterator<Attribute> i = event.getAttributes(); i.hasNext();) { Attribute staxAttr = i.next(); String uri = staxAttr.getName().getNamespaceURI(); if (uri == null) { uri = ""; } String localName = staxAttr.getName().getLocalPart(); String prefix = staxAttr.getName().getPrefix(); String qName; if (prefix == null || prefix.length() == 0) { qName = localName; } else { qName = prefix + ':' + localName; } String type = staxAttr.getDTDType(); String value = staxAttr.getValue(); attrs.addAttribute(uri, localName, qName, type, value); } return attrs; } }
public class class_name { private Attributes getAttributes(StartElement event) { AttributesImpl attrs = new AttributesImpl(); if (!event.isStartElement()) { throw new InternalError("getAttributes() attempting to process: " + event); } // Add namspace declarations if required if (this.filter.getNamespacePrefixes()) { for (@SuppressWarnings("unchecked") Iterator<Namespace> i = event.getNamespaces(); i.hasNext();) { Namespace staxNamespace = i.next(); String uri = staxNamespace.getNamespaceURI(); if (uri == null) { uri = ""; // depends on control dependency: [if], data = [none] } String prefix = staxNamespace.getPrefix(); if (prefix == null) { prefix = ""; // depends on control dependency: [if], data = [none] } String qName = "xmlns"; if (prefix.length() == 0) { prefix = qName; // depends on control dependency: [if], data = [none] } else { qName = qName + ':' + prefix; // depends on control dependency: [if], data = [none] } attrs.addAttribute("http://www.w3.org/2000/xmlns/", prefix, qName, "CDATA", uri); } } // gather non-namespace attrs for (@SuppressWarnings("unchecked") Iterator<Attribute> i = event.getAttributes(); i.hasNext();) { // depends on control dependency: [for], data = [none] Attribute staxAttr = i.next(); String uri = staxAttr.getName().getNamespaceURI(); if (uri == null) { uri = ""; // depends on control dependency: [if], data = [none] } String localName = staxAttr.getName().getLocalPart(); String prefix = staxAttr.getName().getPrefix(); String qName; if (prefix == null || prefix.length() == 0) { qName = localName; // depends on control dependency: [if], data = [none] } else { qName = prefix + ':' + localName; // depends on control dependency: [if], data = [none] } String type = staxAttr.getDTDType(); String value = staxAttr.getValue(); attrs.addAttribute(uri, localName, qName, type, value); } return attrs; // depends on control dependency: [for], data = [none] } }
public class class_name { public void setModel(@Nonnull final MindMap model, final boolean notifyModelChangeListeners) { this.lock(); try { if (this.elementUnderEdit != null) { Utils.safeSwingBlockingCall(new Runnable() { @Override public void run() { endEdit(false); } }); } final List<int[]> selectedPaths = new ArrayList<int[]>(); for (final Topic t : this.selectedTopics) { selectedPaths.add(t.getPositionPath()); } this.selectedTopics.clear(); final MindMap oldModel = this.model; this.model = assertNotNull("Model must not be null", model); for (final PanelAwarePlugin p : MindMapPluginRegistry.getInstance().findFor(PanelAwarePlugin.class)) { p.onPanelModelChange(this, oldModel, this.model); } doLayout(); revalidate(); boolean selectionChanged = false; for (final int[] posPath : selectedPaths) { final Topic topic = this.model.findForPositionPath(posPath); if (topic == null) { selectionChanged = true; } else if (!MindMapUtils.isHidden(topic)) { this.selectedTopics.add(topic); } } if (selectionChanged) { fireNotificationSelectionChanged(); } repaint(); } finally { this.unlock(); if (notifyModelChangeListeners) { fireNotificationMindMapChanged(true); } } } }
public class class_name { public void setModel(@Nonnull final MindMap model, final boolean notifyModelChangeListeners) { this.lock(); try { if (this.elementUnderEdit != null) { Utils.safeSwingBlockingCall(new Runnable() { @Override public void run() { endEdit(false); } }); // depends on control dependency: [if], data = [none] } final List<int[]> selectedPaths = new ArrayList<int[]>(); for (final Topic t : this.selectedTopics) { selectedPaths.add(t.getPositionPath()); // depends on control dependency: [for], data = [t] } this.selectedTopics.clear(); // depends on control dependency: [try], data = [none] final MindMap oldModel = this.model; this.model = assertNotNull("Model must not be null", model); // depends on control dependency: [try], data = [none] for (final PanelAwarePlugin p : MindMapPluginRegistry.getInstance().findFor(PanelAwarePlugin.class)) { p.onPanelModelChange(this, oldModel, this.model); // depends on control dependency: [for], data = [p] } doLayout(); // depends on control dependency: [try], data = [none] revalidate(); // depends on control dependency: [try], data = [none] boolean selectionChanged = false; for (final int[] posPath : selectedPaths) { final Topic topic = this.model.findForPositionPath(posPath); if (topic == null) { selectionChanged = true; // depends on control dependency: [if], data = [none] } else if (!MindMapUtils.isHidden(topic)) { this.selectedTopics.add(topic); // depends on control dependency: [if], data = [none] } } if (selectionChanged) { fireNotificationSelectionChanged(); // depends on control dependency: [if], data = [none] } repaint(); // depends on control dependency: [try], data = [none] } finally { this.unlock(); if (notifyModelChangeListeners) { fireNotificationMindMapChanged(true); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public List<N> getConnectedComponents() { setMarkedAllNodes(false); ArrayList<N> roots = new ArrayList<N>(); //for (int i=0; i<nodes.size(); i++) { for (N n : nodes) { if (!n.isMarked()) { roots.add(n); dfs(n); } } return roots; } }
public class class_name { public List<N> getConnectedComponents() { setMarkedAllNodes(false); ArrayList<N> roots = new ArrayList<N>(); //for (int i=0; i<nodes.size(); i++) { for (N n : nodes) { if (!n.isMarked()) { roots.add(n); // depends on control dependency: [if], data = [none] dfs(n); // depends on control dependency: [if], data = [none] } } return roots; } }
public class class_name { private List<ScoreWeight> processWidgetScores(List<Widget> widgets, ScoreCriteriaSettings scoreCriteriaSettings) { List<ScoreWeight> scoreWeights = new ArrayList<>(); Map<String, ScoreComponentSettings> scoreParamSettingsMap = generateWidgetSettings(scoreCriteriaSettings); Set<String> widgetTypes = scoreParamSettingsMap.keySet(); if (widgetTypes.isEmpty()) { return null; } //For each widget calculate score for (String widgetType : widgetTypes) { ScoreComponentSettings scoreSettings = scoreParamSettingsMap.get(widgetType); WidgetScore widgetScore = getWidgetScoreByType(widgetType); ScoreWeight score = widgetScore.processWidgetScore( getWidgetByName(widgets, widgetType), scoreSettings ); LOGGER.info("Widget for type: " + widgetType + " score" + score); if (null != score) { setWidgetAlert(score, scoreCriteriaSettings.getComponentAlert()); scoreWeights.add(score); } } return scoreWeights; } }
public class class_name { private List<ScoreWeight> processWidgetScores(List<Widget> widgets, ScoreCriteriaSettings scoreCriteriaSettings) { List<ScoreWeight> scoreWeights = new ArrayList<>(); Map<String, ScoreComponentSettings> scoreParamSettingsMap = generateWidgetSettings(scoreCriteriaSettings); Set<String> widgetTypes = scoreParamSettingsMap.keySet(); if (widgetTypes.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } //For each widget calculate score for (String widgetType : widgetTypes) { ScoreComponentSettings scoreSettings = scoreParamSettingsMap.get(widgetType); WidgetScore widgetScore = getWidgetScoreByType(widgetType); ScoreWeight score = widgetScore.processWidgetScore( getWidgetByName(widgets, widgetType), scoreSettings ); LOGGER.info("Widget for type: " + widgetType + " score" + score); // depends on control dependency: [for], data = [widgetType] if (null != score) { setWidgetAlert(score, scoreCriteriaSettings.getComponentAlert()); // depends on control dependency: [if], data = [none] scoreWeights.add(score); // depends on control dependency: [if], data = [score)] } } return scoreWeights; } }
public class class_name { public CompletableFuture<Collection<InetSocketAddress>> getRpcNodeAddresses(final Serializable userid) { if (this.sncpNodeAddresses != null) { tryAcquireSemaphore(); CompletableFuture<Collection<InetSocketAddress>> result = this.sncpNodeAddresses.getCollectionAsync(SOURCE_SNCP_USERID_PREFIX + userid, InetSocketAddress.class); if (semaphore != null) result.whenComplete((r, e) -> releaseSemaphore()); return result; } List<InetSocketAddress> rs = new ArrayList<>(); rs.add(this.localSncpAddress); return CompletableFuture.completedFuture(rs); } }
public class class_name { public CompletableFuture<Collection<InetSocketAddress>> getRpcNodeAddresses(final Serializable userid) { if (this.sncpNodeAddresses != null) { tryAcquireSemaphore(); // depends on control dependency: [if], data = [none] CompletableFuture<Collection<InetSocketAddress>> result = this.sncpNodeAddresses.getCollectionAsync(SOURCE_SNCP_USERID_PREFIX + userid, InetSocketAddress.class); if (semaphore != null) result.whenComplete((r, e) -> releaseSemaphore()); return result; // depends on control dependency: [if], data = [none] } List<InetSocketAddress> rs = new ArrayList<>(); rs.add(this.localSncpAddress); return CompletableFuture.completedFuture(rs); } }
public class class_name { public final String getClearDeletedMode() { // m_clearDeletedMode will be null in initial display because constructor triggers this before member initialization String result = m_clearDeletedMode; if (result == null) { result = MODE_CLEANDELETED_KEEP_RESTORE_VERSION; } return result; } }
public class class_name { public final String getClearDeletedMode() { // m_clearDeletedMode will be null in initial display because constructor triggers this before member initialization String result = m_clearDeletedMode; if (result == null) { result = MODE_CLEANDELETED_KEEP_RESTORE_VERSION; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public void copyFrom(UnsafeRow row) { // copyFrom is only available for UnsafeRow created from byte array. assert (baseObject instanceof byte[]) && baseOffset == Platform.BYTE_ARRAY_OFFSET; if (row.sizeInBytes > this.sizeInBytes) { // resize the underlying byte[] if it's not large enough. this.baseObject = new byte[row.sizeInBytes]; } Platform.copyMemory( row.baseObject, row.baseOffset, this.baseObject, this.baseOffset, row.sizeInBytes); // update the sizeInBytes. this.sizeInBytes = row.sizeInBytes; } }
public class class_name { public void copyFrom(UnsafeRow row) { // copyFrom is only available for UnsafeRow created from byte array. assert (baseObject instanceof byte[]) && baseOffset == Platform.BYTE_ARRAY_OFFSET; if (row.sizeInBytes > this.sizeInBytes) { // resize the underlying byte[] if it's not large enough. this.baseObject = new byte[row.sizeInBytes]; // depends on control dependency: [if], data = [none] } Platform.copyMemory( row.baseObject, row.baseOffset, this.baseObject, this.baseOffset, row.sizeInBytes); // update the sizeInBytes. this.sizeInBytes = row.sizeInBytes; } }
public class class_name { public <T extends Throwable> JKExceptionHandlerInfo getHandler(final T t) { JKExceptionHandlerInfo info = getHandler(t.getClass()); if (info != null) { info.setException(t); } if (info == null && t.getCause() != null) { info = getHandler(t.getCause()); } return info; } }
public class class_name { public <T extends Throwable> JKExceptionHandlerInfo getHandler(final T t) { JKExceptionHandlerInfo info = getHandler(t.getClass()); if (info != null) { info.setException(t); // depends on control dependency: [if], data = [none] } if (info == null && t.getCause() != null) { info = getHandler(t.getCause()); // depends on control dependency: [if], data = [none] } return info; } }
public class class_name { public static void close(SolrClient solrClient) { Assert.notNull(solrClient, "SolrClient must not be null!"); try { if (solrClient instanceof Closeable) { solrClient.close(); } else { Method shutdownMethod = ReflectionUtils.findMethod(solrClient.getClass(), "shutdown"); if (shutdownMethod != null) { shutdownMethod.invoke(solrClient); } } } catch (Exception e) { throw new DataAccessResourceFailureException("Cannot close SolrClient", e); } } }
public class class_name { public static void close(SolrClient solrClient) { Assert.notNull(solrClient, "SolrClient must not be null!"); try { if (solrClient instanceof Closeable) { solrClient.close(); // depends on control dependency: [if], data = [none] } else { Method shutdownMethod = ReflectionUtils.findMethod(solrClient.getClass(), "shutdown"); if (shutdownMethod != null) { shutdownMethod.invoke(solrClient); // depends on control dependency: [if], data = [none] } } } catch (Exception e) { throw new DataAccessResourceFailureException("Cannot close SolrClient", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void createClassLevelAccumulators(OnDemandStatsProducer<T> producer, Class producerClass) { //several @Accumulators in accumulators holder Accumulates accAnnotationHolder = AnnotationUtils.findAnnotation(producerClass, Accumulates.class);//(Accumulates) producerClass.getAnnotation(Accumulates.class); if (accAnnotationHolder != null) { Accumulate[] accAnnotations = accAnnotationHolder.value(); for (Accumulate accAnnotation : accAnnotations) { createAccumulator( producer.getProducerId(), accAnnotation, formAccumulatorNameForClass(producer, accAnnotation), "cumulated"); } } //If there is no @Accumulates annotation but @Accumulate is present Accumulate annotation = AnnotationUtils.findAnnotation(producerClass, Accumulate.class);//producerClass.getAnnotation(Accumulate.class); createAccumulator( producer.getProducerId(), annotation, formAccumulatorNameForClass(producer, annotation), "cumulated" ); } }
public class class_name { private void createClassLevelAccumulators(OnDemandStatsProducer<T> producer, Class producerClass) { //several @Accumulators in accumulators holder Accumulates accAnnotationHolder = AnnotationUtils.findAnnotation(producerClass, Accumulates.class);//(Accumulates) producerClass.getAnnotation(Accumulates.class); if (accAnnotationHolder != null) { Accumulate[] accAnnotations = accAnnotationHolder.value(); for (Accumulate accAnnotation : accAnnotations) { createAccumulator( producer.getProducerId(), accAnnotation, formAccumulatorNameForClass(producer, accAnnotation), "cumulated"); // depends on control dependency: [for], data = [none] } } //If there is no @Accumulates annotation but @Accumulate is present Accumulate annotation = AnnotationUtils.findAnnotation(producerClass, Accumulate.class);//producerClass.getAnnotation(Accumulate.class); createAccumulator( producer.getProducerId(), annotation, formAccumulatorNameForClass(producer, annotation), "cumulated" ); } }
public class class_name { public RequestedLocalProperties filterByNodesConstantSet(OptimizerNode node, int input) { if (this.ordering != null) { final FieldList involvedIndexes = this.ordering.getInvolvedIndexes(); for (int i = 0; i < involvedIndexes.size(); i++) { if (!node.isFieldConstant(input, involvedIndexes.get(i))) { return null; } } } else if (this.groupedFields != null) { // check, whether the local key grouping is preserved for (Integer index : this.groupedFields) { if (!node.isFieldConstant(input, index)) { return null; } } } return this; } }
public class class_name { public RequestedLocalProperties filterByNodesConstantSet(OptimizerNode node, int input) { if (this.ordering != null) { final FieldList involvedIndexes = this.ordering.getInvolvedIndexes(); for (int i = 0; i < involvedIndexes.size(); i++) { if (!node.isFieldConstant(input, involvedIndexes.get(i))) { return null; // depends on control dependency: [if], data = [none] } } } else if (this.groupedFields != null) { // check, whether the local key grouping is preserved for (Integer index : this.groupedFields) { if (!node.isFieldConstant(input, index)) { return null; // depends on control dependency: [if], data = [none] } } } return this; } }
public class class_name { @Override public CommerceNotificationTemplateUserSegmentRel remove( Serializable primaryKey) throws NoSuchNotificationTemplateUserSegmentRelException { Session session = null; try { session = openSession(); CommerceNotificationTemplateUserSegmentRel commerceNotificationTemplateUserSegmentRel = (CommerceNotificationTemplateUserSegmentRel)session.get(CommerceNotificationTemplateUserSegmentRelImpl.class, primaryKey); if (commerceNotificationTemplateUserSegmentRel == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchNotificationTemplateUserSegmentRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(commerceNotificationTemplateUserSegmentRel); } catch (NoSuchNotificationTemplateUserSegmentRelException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { @Override public CommerceNotificationTemplateUserSegmentRel remove( Serializable primaryKey) throws NoSuchNotificationTemplateUserSegmentRelException { Session session = null; try { session = openSession(); CommerceNotificationTemplateUserSegmentRel commerceNotificationTemplateUserSegmentRel = (CommerceNotificationTemplateUserSegmentRel)session.get(CommerceNotificationTemplateUserSegmentRelImpl.class, primaryKey); if (commerceNotificationTemplateUserSegmentRel == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none] } throw new NoSuchNotificationTemplateUserSegmentRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(commerceNotificationTemplateUserSegmentRel); } catch (NoSuchNotificationTemplateUserSegmentRelException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { public static byte[] toByteArray(long value) { // Note that this code needs to stay compatible with GWT, which has known // bugs when narrowing byte casts of long values occur. byte[] result = new byte[8]; for (int i = 7; i >= 0; i--) { result[i] = (byte) (value & 0xffL); value >>= 8; } return result; } }
public class class_name { public static byte[] toByteArray(long value) { // Note that this code needs to stay compatible with GWT, which has known // bugs when narrowing byte casts of long values occur. byte[] result = new byte[8]; for (int i = 7; i >= 0; i--) { result[i] = (byte) (value & 0xffL); // depends on control dependency: [for], data = [i] value >>= 8; // depends on control dependency: [for], data = [none] } return result; } }
public class class_name { static public String format(Collection<?> collection, String property, String separator, boolean trim) { StringBuilder sb = new StringBuilder(); if (collection != null){ for (Object o: collection){ Object p = null; if (property == null){ p = o; }else{ try { p = PropertyUtils.getProperty(o, property); } catch (Exception e) { p = "ACCESS_ERROR:" + property; } } sb.append(p == null? "null" : (trim? p.toString().trim() : p.toString())); sb.append(separator); } } if (sb.length() > 0){ sb.setLength(sb.length() - separator.length()); } return sb.toString(); } }
public class class_name { static public String format(Collection<?> collection, String property, String separator, boolean trim) { StringBuilder sb = new StringBuilder(); if (collection != null){ for (Object o: collection){ Object p = null; if (property == null){ p = o; // depends on control dependency: [if], data = [none] }else{ try { p = PropertyUtils.getProperty(o, property); // depends on control dependency: [try], data = [none] } catch (Exception e) { p = "ACCESS_ERROR:" + property; } // depends on control dependency: [catch], data = [none] } sb.append(p == null? "null" : (trim? p.toString().trim() : p.toString())); // depends on control dependency: [for], data = [o] sb.append(separator); // depends on control dependency: [for], data = [o] } } if (sb.length() > 0){ sb.setLength(sb.length() - separator.length()); // depends on control dependency: [if], data = [(sb.length()] } return sb.toString(); } }
public class class_name { private static Prompt createPrompt(Resource<?> currentResource) { // [ currentdir]$ if (OperatingSystemUtils.isWindows()) { List<TerminalCharacter> prompt = new LinkedList<>(); prompt.add(new TerminalCharacter('[')); for (char c : currentResource.getName().toCharArray()) { prompt.add(new TerminalCharacter(c)); } prompt.add(new TerminalCharacter(']')); prompt.add(new TerminalCharacter('$')); prompt.add(new TerminalCharacter(' ')); return new Prompt(prompt); } else { List<TerminalCharacter> prompt = new LinkedList<>(); prompt.add(new TerminalCharacter('[', new TerminalColor(Color.BLUE, Color.DEFAULT), CharacterType.BOLD)); for (char c : currentResource.getName().toCharArray()) { prompt.add(new TerminalCharacter(c)); } prompt.add(new TerminalCharacter(']', new TerminalColor(Color.BLUE, Color.DEFAULT), CharacterType.BOLD)); prompt.add(new TerminalCharacter('$')); prompt.add(new TerminalCharacter(' ')); return new Prompt(prompt); } } }
public class class_name { private static Prompt createPrompt(Resource<?> currentResource) { // [ currentdir]$ if (OperatingSystemUtils.isWindows()) { List<TerminalCharacter> prompt = new LinkedList<>(); prompt.add(new TerminalCharacter('[')); // depends on control dependency: [if], data = [none] for (char c : currentResource.getName().toCharArray()) { prompt.add(new TerminalCharacter(c)); // depends on control dependency: [for], data = [c] } prompt.add(new TerminalCharacter(']')); // depends on control dependency: [if], data = [none] prompt.add(new TerminalCharacter('$')); // depends on control dependency: [if], data = [none] prompt.add(new TerminalCharacter(' ')); // depends on control dependency: [if], data = [none] return new Prompt(prompt); // depends on control dependency: [if], data = [none] } else { List<TerminalCharacter> prompt = new LinkedList<>(); prompt.add(new TerminalCharacter('[', new TerminalColor(Color.BLUE, Color.DEFAULT), CharacterType.BOLD)); // depends on control dependency: [if], data = [none] for (char c : currentResource.getName().toCharArray()) { prompt.add(new TerminalCharacter(c)); // depends on control dependency: [for], data = [c] } prompt.add(new TerminalCharacter(']', new TerminalColor(Color.BLUE, Color.DEFAULT), CharacterType.BOLD)); // depends on control dependency: [if], data = [none] prompt.add(new TerminalCharacter('$')); // depends on control dependency: [if], data = [none] prompt.add(new TerminalCharacter(' ')); // depends on control dependency: [if], data = [none] return new Prompt(prompt); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Map<String, CmsPermissionSet> getReadPermissions() { if (m_permissions == null) { // create lazy map only on demand m_permissions = CmsCollectionsGenericWrapper.createLazyMap(new CmsPermissionsLoaderTransformer()); } return m_permissions; } }
public class class_name { public Map<String, CmsPermissionSet> getReadPermissions() { if (m_permissions == null) { // create lazy map only on demand m_permissions = CmsCollectionsGenericWrapper.createLazyMap(new CmsPermissionsLoaderTransformer()); // depends on control dependency: [if], data = [none] } return m_permissions; } }
public class class_name { int getSecondaryBefore(long p, int s) { int index; int previousSec, sec; if(p == 0) { index = (int)elements[IX_FIRST_SECONDARY_INDEX]; // Gap at the beginning of the secondary CE range. previousSec = 0; sec = (int)(elements[index] >> 16); } else { index = findPrimary(p) + 1; previousSec = Collation.BEFORE_WEIGHT16; sec = (int)getFirstSecTerForPrimary(index) >>> 16; } assert(s >= sec); while(s > sec) { previousSec = sec; assert((elements[index] & SEC_TER_DELTA_FLAG) != 0); sec = (int)(elements[index++] >> 16); } assert(sec == s); return previousSec; } }
public class class_name { int getSecondaryBefore(long p, int s) { int index; int previousSec, sec; if(p == 0) { index = (int)elements[IX_FIRST_SECONDARY_INDEX]; // depends on control dependency: [if], data = [none] // Gap at the beginning of the secondary CE range. previousSec = 0; // depends on control dependency: [if], data = [none] sec = (int)(elements[index] >> 16); // depends on control dependency: [if], data = [none] } else { index = findPrimary(p) + 1; // depends on control dependency: [if], data = [(p] previousSec = Collation.BEFORE_WEIGHT16; // depends on control dependency: [if], data = [none] sec = (int)getFirstSecTerForPrimary(index) >>> 16; // depends on control dependency: [if], data = [none] } assert(s >= sec); while(s > sec) { previousSec = sec; // depends on control dependency: [while], data = [none] assert((elements[index] & SEC_TER_DELTA_FLAG) != 0); // depends on control dependency: [while], data = [none] sec = (int)(elements[index++] >> 16); // depends on control dependency: [while], data = [none] } assert(sec == s); return previousSec; } }
public class class_name { @Override void addRelation(int strength, CharSequence prefix, CharSequence str, CharSequence extension) { String nfdPrefix; if(prefix.length() == 0) { nfdPrefix = ""; } else { nfdPrefix = nfd.normalize(prefix); } String nfdString = nfd.normalize(str); // The runtime code decomposes Hangul syllables on the fly, // with recursive processing but without making the Jamo pieces visible for matching. // It does not work with certain types of contextual mappings. int nfdLength = nfdString.length(); if(nfdLength >= 2) { char c = nfdString.charAt(0); if(Hangul.isJamoL(c) || Hangul.isJamoV(c)) { // While handling a Hangul syllable, contractions starting with Jamo L or V // would not see the following Jamo of that syllable. throw new UnsupportedOperationException( "contractions starting with conjoining Jamo L or V not supported"); } c = nfdString.charAt(nfdLength - 1); if(Hangul.isJamoL(c) || (Hangul.isJamoV(c) && Hangul.isJamoL(nfdString.charAt(nfdLength - 2)))) { // A contraction ending with Jamo L or L+V would require // generating Hangul syllables in addTailComposites() (588 for a Jamo L), // or decomposing a following Hangul syllable on the fly, during contraction matching. throw new UnsupportedOperationException( "contractions ending with conjoining Jamo L or L+V not supported"); } // A Hangul syllable completely inside a contraction is ok. } // Note: If there is a prefix, then the parser checked that // both the prefix and the string beging with NFC boundaries (not Jamo V or T). // Therefore: prefix.isEmpty() || !isJamoVOrT(nfdString.charAt(0)) // (While handling a Hangul syllable, prefixes on Jamo V or T // would not see the previous Jamo of that syllable.) if(strength != Collator.IDENTICAL) { // Find the node index after which we insert the new tailored node. int index = findOrInsertNodeForCEs(strength); assert(cesLength > 0); long ce = ces[cesLength - 1]; if(strength == Collator.PRIMARY && !isTempCE(ce) && (ce >>> 32) == 0) { // There is no primary gap between ignorables and the space-first-primary. throw new UnsupportedOperationException( "tailoring primary after ignorables not supported"); } if(strength == Collator.QUATERNARY && ce == 0) { // The CE data structure does not support non-zero quaternary weights // on tertiary ignorables. throw new UnsupportedOperationException( "tailoring quaternary after tertiary ignorables not supported"); } // Insert the new tailored node. index = insertTailoredNodeAfter(index, strength); // Strength of the temporary CE: // The new relation may yield a stronger CE but not a weaker one. int tempStrength = ceStrength(ce); if(strength < tempStrength) { tempStrength = strength; } ces[cesLength - 1] = tempCEFromIndexAndStrength(index, tempStrength); } setCaseBits(nfdString); int cesLengthBeforeExtension = cesLength; if(extension.length() != 0) { String nfdExtension = nfd.normalize(extension); cesLength = dataBuilder.getCEs(nfdExtension, ces, cesLength); if(cesLength > Collation.MAX_EXPANSION_LENGTH) { throw new IllegalArgumentException( "extension string adds too many collation elements (more than 31 total)"); } } int ce32 = Collation.UNASSIGNED_CE32; if((!nfdPrefix.contentEquals(prefix) || !nfdString.contentEquals(str)) && !ignorePrefix(prefix) && !ignoreString(str)) { // Map from the original input to the CEs. // We do this in case the canonical closure is incomplete, // so that it is possible to explicitly provide the missing mappings. ce32 = addIfDifferent(prefix, str, ces, cesLength, ce32); } addWithClosure(nfdPrefix, nfdString, ces, cesLength, ce32); cesLength = cesLengthBeforeExtension; } }
public class class_name { @Override void addRelation(int strength, CharSequence prefix, CharSequence str, CharSequence extension) { String nfdPrefix; if(prefix.length() == 0) { nfdPrefix = ""; // depends on control dependency: [if], data = [none] } else { nfdPrefix = nfd.normalize(prefix); // depends on control dependency: [if], data = [none] } String nfdString = nfd.normalize(str); // The runtime code decomposes Hangul syllables on the fly, // with recursive processing but without making the Jamo pieces visible for matching. // It does not work with certain types of contextual mappings. int nfdLength = nfdString.length(); if(nfdLength >= 2) { char c = nfdString.charAt(0); if(Hangul.isJamoL(c) || Hangul.isJamoV(c)) { // While handling a Hangul syllable, contractions starting with Jamo L or V // would not see the following Jamo of that syllable. throw new UnsupportedOperationException( "contractions starting with conjoining Jamo L or V not supported"); } c = nfdString.charAt(nfdLength - 1); // depends on control dependency: [if], data = [(nfdLength] if(Hangul.isJamoL(c) || (Hangul.isJamoV(c) && Hangul.isJamoL(nfdString.charAt(nfdLength - 2)))) { // A contraction ending with Jamo L or L+V would require // generating Hangul syllables in addTailComposites() (588 for a Jamo L), // or decomposing a following Hangul syllable on the fly, during contraction matching. throw new UnsupportedOperationException( "contractions ending with conjoining Jamo L or L+V not supported"); } // A Hangul syllable completely inside a contraction is ok. } // Note: If there is a prefix, then the parser checked that // both the prefix and the string beging with NFC boundaries (not Jamo V or T). // Therefore: prefix.isEmpty() || !isJamoVOrT(nfdString.charAt(0)) // (While handling a Hangul syllable, prefixes on Jamo V or T // would not see the previous Jamo of that syllable.) if(strength != Collator.IDENTICAL) { // Find the node index after which we insert the new tailored node. int index = findOrInsertNodeForCEs(strength); assert(cesLength > 0); // depends on control dependency: [if], data = [none] long ce = ces[cesLength - 1]; if(strength == Collator.PRIMARY && !isTempCE(ce) && (ce >>> 32) == 0) { // There is no primary gap between ignorables and the space-first-primary. throw new UnsupportedOperationException( "tailoring primary after ignorables not supported"); } if(strength == Collator.QUATERNARY && ce == 0) { // The CE data structure does not support non-zero quaternary weights // on tertiary ignorables. throw new UnsupportedOperationException( "tailoring quaternary after tertiary ignorables not supported"); } // Insert the new tailored node. index = insertTailoredNodeAfter(index, strength); // depends on control dependency: [if], data = [none] // Strength of the temporary CE: // The new relation may yield a stronger CE but not a weaker one. int tempStrength = ceStrength(ce); if(strength < tempStrength) { tempStrength = strength; } // depends on control dependency: [if], data = [none] ces[cesLength - 1] = tempCEFromIndexAndStrength(index, tempStrength); // depends on control dependency: [if], data = [none] } setCaseBits(nfdString); int cesLengthBeforeExtension = cesLength; if(extension.length() != 0) { String nfdExtension = nfd.normalize(extension); cesLength = dataBuilder.getCEs(nfdExtension, ces, cesLength); // depends on control dependency: [if], data = [none] if(cesLength > Collation.MAX_EXPANSION_LENGTH) { throw new IllegalArgumentException( "extension string adds too many collation elements (more than 31 total)"); } } int ce32 = Collation.UNASSIGNED_CE32; if((!nfdPrefix.contentEquals(prefix) || !nfdString.contentEquals(str)) && !ignorePrefix(prefix) && !ignoreString(str)) { // Map from the original input to the CEs. // We do this in case the canonical closure is incomplete, // so that it is possible to explicitly provide the missing mappings. ce32 = addIfDifferent(prefix, str, ces, cesLength, ce32); // depends on control dependency: [if], data = [none] } addWithClosure(nfdPrefix, nfdString, ces, cesLength, ce32); cesLength = cesLengthBeforeExtension; } }
public class class_name { public static Map getPropertyDescriptors(Class targetClass) throws IntrospectionException, OgnlException { Map result; if ((result = (Map) _propertyDescriptorCache.get(targetClass)) == null) { synchronized (_propertyDescriptorCache) { if ((result = (Map) _propertyDescriptorCache.get(targetClass)) == null) { PropertyDescriptor[] pda = Introspector.getBeanInfo(targetClass).getPropertyDescriptors(); result = new HashMap(101); for (int i = 0, icount = pda.length; i < icount; i++) { // workaround for Introspector bug 6528714 (bugs.sun.com) if (pda[i].getReadMethod() != null && !isMethodCallable(pda[i].getReadMethod())) { pda[i].setReadMethod(findClosestMatchingMethod(targetClass, pda[i].getReadMethod(), pda[i].getName(), pda[i].getPropertyType(), true)); } if (pda[i].getWriteMethod() != null && !isMethodCallable(pda[i].getWriteMethod())) { pda[i].setWriteMethod(findClosestMatchingMethod(targetClass, pda[i].getWriteMethod(), pda[i].getName(), pda[i].getPropertyType(), false)); } result.put(pda[i].getName(), pda[i]); } findObjectIndexedPropertyDescriptors(targetClass, result); _propertyDescriptorCache.put(targetClass, result); } } } return result; } }
public class class_name { public static Map getPropertyDescriptors(Class targetClass) throws IntrospectionException, OgnlException { Map result; if ((result = (Map) _propertyDescriptorCache.get(targetClass)) == null) { synchronized (_propertyDescriptorCache) { if ((result = (Map) _propertyDescriptorCache.get(targetClass)) == null) { PropertyDescriptor[] pda = Introspector.getBeanInfo(targetClass).getPropertyDescriptors(); result = new HashMap(101); // depends on control dependency: [if], data = [none] for (int i = 0, icount = pda.length; i < icount; i++) { // workaround for Introspector bug 6528714 (bugs.sun.com) if (pda[i].getReadMethod() != null && !isMethodCallable(pda[i].getReadMethod())) { pda[i].setReadMethod(findClosestMatchingMethod(targetClass, pda[i].getReadMethod(), pda[i].getName(), pda[i].getPropertyType(), true)); // depends on control dependency: [if], data = [none] } if (pda[i].getWriteMethod() != null && !isMethodCallable(pda[i].getWriteMethod())) { pda[i].setWriteMethod(findClosestMatchingMethod(targetClass, pda[i].getWriteMethod(), pda[i].getName(), pda[i].getPropertyType(), false)); // depends on control dependency: [if], data = [none] } result.put(pda[i].getName(), pda[i]); // depends on control dependency: [for], data = [i] } findObjectIndexedPropertyDescriptors(targetClass, result); // depends on control dependency: [if], data = [none] _propertyDescriptorCache.put(targetClass, result); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { static public List<ICacheKeyGenerator> combine(List<ICacheKeyGenerator> a, List<ICacheKeyGenerator> b) { if (a == null) { return b; } else if (b == null) { return a; } if (a.size() != b.size()) { throw new IllegalStateException(); } ICacheKeyGenerator[] combined = new ICacheKeyGenerator[a.size()]; boolean modified = false; for (int i = 0; i < a.size(); i++) { combined[i] = a.get(i).combine(b.get(i)); modified = modified || combined[i] != a.get(i); } return modified ? Arrays.asList(combined) : a; } }
public class class_name { static public List<ICacheKeyGenerator> combine(List<ICacheKeyGenerator> a, List<ICacheKeyGenerator> b) { if (a == null) { return b; // depends on control dependency: [if], data = [none] } else if (b == null) { return a; // depends on control dependency: [if], data = [none] } if (a.size() != b.size()) { throw new IllegalStateException(); } ICacheKeyGenerator[] combined = new ICacheKeyGenerator[a.size()]; boolean modified = false; for (int i = 0; i < a.size(); i++) { combined[i] = a.get(i).combine(b.get(i)); // depends on control dependency: [for], data = [i] modified = modified || combined[i] != a.get(i); // depends on control dependency: [for], data = [i] } return modified ? Arrays.asList(combined) : a; } }
public class class_name { void addOutput() { if( output != null ) { outputs.addLast( output ); } output = state.pool.get(); } }
public class class_name { void addOutput() { if( output != null ) { outputs.addLast( output ); // depends on control dependency: [if], data = [( output] } output = state.pool.get(); } }
public class class_name { public static Map<String, String> getLdapSettingsForApp(App app) { Map<String, String> ldapSettings = new HashMap<>(); if (app != null) { ldapSettings.put("security.ldap.server_url", "ldap://localhost:8389/"); ldapSettings.put("security.ldap.active_directory_domain", ""); ldapSettings.put("security.ldap.base_dn", "dc=springframework,dc=org"); ldapSettings.put("security.ldap.bind_dn", ""); ldapSettings.put("security.ldap.bind_pass", ""); ldapSettings.put("security.ldap.user_search_base", ""); ldapSettings.put("security.ldap.user_search_filter", "(cn={0})"); ldapSettings.put("security.ldap.user_dn_pattern", "uid={0},ou=people"); ldapSettings.put("security.ldap.password_attribute", "userPassword"); //ldapSettings.put("security.ldap.compare_passwords", "false"); //don't remove comment Map<String, Object> settings = app.getSettings(); for (Map.Entry<String, String> entry : ldapSettings.entrySet()) { if (settings.containsKey(entry.getKey())) { entry.setValue(settings.get(entry.getKey()) + ""); } else if (app.isRootApp()) { entry.setValue(Config.getConfigParam(entry.getKey(), entry.getValue())); } } } return ldapSettings; } }
public class class_name { public static Map<String, String> getLdapSettingsForApp(App app) { Map<String, String> ldapSettings = new HashMap<>(); if (app != null) { ldapSettings.put("security.ldap.server_url", "ldap://localhost:8389/"); ldapSettings.put("security.ldap.active_directory_domain", ""); ldapSettings.put("security.ldap.base_dn", "dc=springframework,dc=org"); // depends on control dependency: [if], data = [none] ldapSettings.put("security.ldap.bind_dn", ""); // depends on control dependency: [if], data = [none] ldapSettings.put("security.ldap.bind_pass", ""); // depends on control dependency: [if], data = [none] ldapSettings.put("security.ldap.user_search_base", ""); // depends on control dependency: [if], data = [none] ldapSettings.put("security.ldap.user_search_filter", "(cn={0})"); // depends on control dependency: [if], data = [none] ldapSettings.put("security.ldap.user_dn_pattern", "uid={0},ou=people"); // depends on control dependency: [if], data = [none] ldapSettings.put("security.ldap.password_attribute", "userPassword"); // depends on control dependency: [if], data = [none] //ldapSettings.put("security.ldap.compare_passwords", "false"); //don't remove comment Map<String, Object> settings = app.getSettings(); for (Map.Entry<String, String> entry : ldapSettings.entrySet()) { if (settings.containsKey(entry.getKey())) { entry.setValue(settings.get(entry.getKey()) + ""); // depends on control dependency: [if], data = [none] } else if (app.isRootApp()) { entry.setValue(Config.getConfigParam(entry.getKey(), entry.getValue())); // depends on control dependency: [if], data = [none] } } } return ldapSettings; } }
public class class_name { private void syncMeta(final TSMeta meta, final boolean overwrite) { // storage *could* have a missing TSUID if something went pear shaped so // only use the one that's configured. If the local is missing, we're foobar if (meta.tsuid != null && !meta.tsuid.isEmpty()) { tsuid = meta.tsuid; } if (tsuid == null || tsuid.isEmpty()) { throw new IllegalArgumentException("TSUID is empty"); } if (meta.created > 0 && (meta.created < created || created == 0)) { created = meta.created; } // handle user-accessible stuff if (!overwrite && !changed.get("display_name")) { display_name = meta.display_name; } if (!overwrite && !changed.get("description")) { description = meta.description; } if (!overwrite && !changed.get("notes")) { notes = meta.notes; } if (!overwrite && !changed.get("custom")) { custom = meta.custom; } if (!overwrite && !changed.get("units")) { units = meta.units; } if (!overwrite && !changed.get("data_type")) { data_type = meta.data_type; } if (!overwrite && !changed.get("retention")) { retention = meta.retention; } if (!overwrite && !changed.get("max")) { max = meta.max; } if (!overwrite && !changed.get("min")) { min = meta.min; } last_received = meta.last_received; total_dps = meta.total_dps; // reset changed flags initializeChangedMap(); } }
public class class_name { private void syncMeta(final TSMeta meta, final boolean overwrite) { // storage *could* have a missing TSUID if something went pear shaped so // only use the one that's configured. If the local is missing, we're foobar if (meta.tsuid != null && !meta.tsuid.isEmpty()) { tsuid = meta.tsuid; // depends on control dependency: [if], data = [none] } if (tsuid == null || tsuid.isEmpty()) { throw new IllegalArgumentException("TSUID is empty"); } if (meta.created > 0 && (meta.created < created || created == 0)) { created = meta.created; // depends on control dependency: [if], data = [none] } // handle user-accessible stuff if (!overwrite && !changed.get("display_name")) { display_name = meta.display_name; // depends on control dependency: [if], data = [none] } if (!overwrite && !changed.get("description")) { description = meta.description; // depends on control dependency: [if], data = [none] } if (!overwrite && !changed.get("notes")) { notes = meta.notes; // depends on control dependency: [if], data = [none] } if (!overwrite && !changed.get("custom")) { custom = meta.custom; // depends on control dependency: [if], data = [none] } if (!overwrite && !changed.get("units")) { units = meta.units; // depends on control dependency: [if], data = [none] } if (!overwrite && !changed.get("data_type")) { data_type = meta.data_type; // depends on control dependency: [if], data = [none] } if (!overwrite && !changed.get("retention")) { retention = meta.retention; // depends on control dependency: [if], data = [none] } if (!overwrite && !changed.get("max")) { max = meta.max; // depends on control dependency: [if], data = [none] } if (!overwrite && !changed.get("min")) { min = meta.min; // depends on control dependency: [if], data = [none] } last_received = meta.last_received; total_dps = meta.total_dps; // reset changed flags initializeChangedMap(); } }
public class class_name { private Collection<? extends java.security.cert.CRL> parseX509orPKCS7CRL(InputStream is) throws CRLException, IOException { Collection<X509CRLImpl> coll = new ArrayList<>(); byte[] data = readOneBlock(is); if (data == null) { return new ArrayList<>(0); } try { PKCS7 pkcs7 = new PKCS7(data); X509CRL[] crls = pkcs7.getCRLs(); // CRLs are optional in PKCS #7 if (crls != null) { return Arrays.asList(crls); } else { // no crls provided return new ArrayList<>(0); } } catch (ParsingException e) { while (data != null) { coll.add(new X509CRLImpl(data)); data = readOneBlock(is); } } return coll; } }
public class class_name { private Collection<? extends java.security.cert.CRL> parseX509orPKCS7CRL(InputStream is) throws CRLException, IOException { Collection<X509CRLImpl> coll = new ArrayList<>(); byte[] data = readOneBlock(is); if (data == null) { return new ArrayList<>(0); } try { PKCS7 pkcs7 = new PKCS7(data); X509CRL[] crls = pkcs7.getCRLs(); // CRLs are optional in PKCS #7 if (crls != null) { return Arrays.asList(crls); // depends on control dependency: [if], data = [(crls] } else { // no crls provided return new ArrayList<>(0); // depends on control dependency: [if], data = [none] } } catch (ParsingException e) { while (data != null) { coll.add(new X509CRLImpl(data)); // depends on control dependency: [while], data = [(data] data = readOneBlock(is); // depends on control dependency: [while], data = [none] } } return coll; } }
public class class_name { public ICompletableFuture<Map<K, Object>> submitToKeys(Set<K> keys, EntryProcessor entryProcessor) { checkNotNull(keys, NULL_KEYS_ARE_NOT_ALLOWED); if (keys.isEmpty()) { return new SimpleCompletedFuture<>(Collections.emptyMap()); } handleHazelcastInstanceAwareParams(entryProcessor); Set<Data> dataKeys = createHashSet(keys.size()); return submitToKeysInternal(keys, dataKeys, entryProcessor); } }
public class class_name { public ICompletableFuture<Map<K, Object>> submitToKeys(Set<K> keys, EntryProcessor entryProcessor) { checkNotNull(keys, NULL_KEYS_ARE_NOT_ALLOWED); if (keys.isEmpty()) { return new SimpleCompletedFuture<>(Collections.emptyMap()); // depends on control dependency: [if], data = [none] } handleHazelcastInstanceAwareParams(entryProcessor); Set<Data> dataKeys = createHashSet(keys.size()); return submitToKeysInternal(keys, dataKeys, entryProcessor); } }
public class class_name { private void getAvailableChanges( final Map<String, String> changes) { WorkflowSystem.OperationCompleted<DAT> task = stateChangeQueue.poll(); while (task != null && task.getNewState() != null) { changes.putAll(task.getNewState().getState()); DAT result = task.getResult(); if (null != sharedData && null != result) { sharedData.addData(result); } task = stateChangeQueue.poll(); } } }
public class class_name { private void getAvailableChanges( final Map<String, String> changes) { WorkflowSystem.OperationCompleted<DAT> task = stateChangeQueue.poll(); while (task != null && task.getNewState() != null) { changes.putAll(task.getNewState().getState()); // depends on control dependency: [while], data = [(task] DAT result = task.getResult(); if (null != sharedData && null != result) { sharedData.addData(result); // depends on control dependency: [if], data = [none] } task = stateChangeQueue.poll(); // depends on control dependency: [while], data = [none] } } }
public class class_name { public boolean isEquivalent(final Plugin testPlugin) { if ((testPlugin != null) && testPlugin instanceof SocketReceiver) { SocketReceiver sReceiver = (SocketReceiver) testPlugin; return (port == sReceiver.getPort() && super.isEquivalent(testPlugin)); } return false; } }
public class class_name { public boolean isEquivalent(final Plugin testPlugin) { if ((testPlugin != null) && testPlugin instanceof SocketReceiver) { SocketReceiver sReceiver = (SocketReceiver) testPlugin; return (port == sReceiver.getPort() && super.isEquivalent(testPlugin)); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { @Override public String getEncodingFromLocale(Locale locale) { if (null == locale) { return null; } if (locale.equals(this.cachedLocale)) { return this.cachedEncoding; } String encoding = localeMap.get(locale.toString()); if (null == encoding) { final String lang = locale.getLanguage(); encoding = localeMap.get(lang + '_' + locale.getCountry()); if (null == encoding) { encoding = localeMap.get(lang); } } this.cachedEncoding = encoding; this.cachedLocale = locale; return encoding; } }
public class class_name { @Override public String getEncodingFromLocale(Locale locale) { if (null == locale) { return null; // depends on control dependency: [if], data = [none] } if (locale.equals(this.cachedLocale)) { return this.cachedEncoding; // depends on control dependency: [if], data = [none] } String encoding = localeMap.get(locale.toString()); if (null == encoding) { final String lang = locale.getLanguage(); encoding = localeMap.get(lang + '_' + locale.getCountry()); // depends on control dependency: [if], data = [none] if (null == encoding) { encoding = localeMap.get(lang); // depends on control dependency: [if], data = [none] } } this.cachedEncoding = encoding; this.cachedLocale = locale; return encoding; } }
public class class_name { public static boolean isProperty(KeyValue kv) { if (Bytes.equals(kv.getFamily(), PROP_COLUMN_FAMILY)) { return true; } return false; } }
public class class_name { public static boolean isProperty(KeyValue kv) { if (Bytes.equals(kv.getFamily(), PROP_COLUMN_FAMILY)) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static File[] getUserExtensionVersionFiles(File installDir) { File[] versionFiles = null; String userDirLoc = System.getenv(BootstrapConstants.ENV_WLP_USER_DIR); File userDir = (userDirLoc != null) ? new File(userDirLoc) : ((installDir != null) ? new File(installDir, "usr") : null); if (userDir != null && userDir.exists()) { File userExtVersionDir = new File(userDir, "extension/lib/versions"); if (userExtVersionDir.exists()) { versionFiles = userExtVersionDir.listFiles(versionFileFilter); } } return versionFiles; } }
public class class_name { public static File[] getUserExtensionVersionFiles(File installDir) { File[] versionFiles = null; String userDirLoc = System.getenv(BootstrapConstants.ENV_WLP_USER_DIR); File userDir = (userDirLoc != null) ? new File(userDirLoc) : ((installDir != null) ? new File(installDir, "usr") : null); if (userDir != null && userDir.exists()) { File userExtVersionDir = new File(userDir, "extension/lib/versions"); if (userExtVersionDir.exists()) { versionFiles = userExtVersionDir.listFiles(versionFileFilter); // depends on control dependency: [if], data = [none] } } return versionFiles; } }
public class class_name { List<MwDumpFile> findDumpsOnline(DumpContentType dumpContentType) { List<String> dumpFileDates = findDumpDatesOnline(dumpContentType); List<MwDumpFile> result = new ArrayList<>(); for (String dateStamp : dumpFileDates) { if (dumpContentType == DumpContentType.DAILY) { result.add(new WmfOnlineDailyDumpFile(dateStamp, this.projectName, this.webResourceFetcher, this.dumpfileDirectoryManager)); } else if (dumpContentType == DumpContentType.JSON) { result.add(new JsonOnlineDumpFile(dateStamp, this.projectName, this.webResourceFetcher, this.dumpfileDirectoryManager)); } else { result.add(new WmfOnlineStandardDumpFile(dateStamp, this.projectName, this.webResourceFetcher, this.dumpfileDirectoryManager, dumpContentType)); } } logger.info("Found " + result.size() + " online dumps of type " + dumpContentType + ": " + result); return result; } }
public class class_name { List<MwDumpFile> findDumpsOnline(DumpContentType dumpContentType) { List<String> dumpFileDates = findDumpDatesOnline(dumpContentType); List<MwDumpFile> result = new ArrayList<>(); for (String dateStamp : dumpFileDates) { if (dumpContentType == DumpContentType.DAILY) { result.add(new WmfOnlineDailyDumpFile(dateStamp, this.projectName, this.webResourceFetcher, this.dumpfileDirectoryManager)); // depends on control dependency: [if], data = [none] } else if (dumpContentType == DumpContentType.JSON) { result.add(new JsonOnlineDumpFile(dateStamp, this.projectName, this.webResourceFetcher, this.dumpfileDirectoryManager)); // depends on control dependency: [if], data = [none] } else { result.add(new WmfOnlineStandardDumpFile(dateStamp, this.projectName, this.webResourceFetcher, this.dumpfileDirectoryManager, dumpContentType)); // depends on control dependency: [if], data = [none] } } logger.info("Found " + result.size() + " online dumps of type " + dumpContentType + ": " + result); return result; } }
public class class_name { public void setDagEdges(java.util.Collection<CodeGenEdge> dagEdges) { if (dagEdges == null) { this.dagEdges = null; return; } this.dagEdges = new java.util.ArrayList<CodeGenEdge>(dagEdges); } }
public class class_name { public void setDagEdges(java.util.Collection<CodeGenEdge> dagEdges) { if (dagEdges == null) { this.dagEdges = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.dagEdges = new java.util.ArrayList<CodeGenEdge>(dagEdges); } }
public class class_name { public void fatalErrorNotification(ManagedConnectionFactory managedConnectionFactory, MCWrapper mcWrapper, Object affinity) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(this, tc, "fatalErrorNotification"); } requestingAccessToPool(); if (mcWrapper != null) { mcWrapper.markStale(); } if (gConfigProps.connectionPoolingEnabled) { if (gConfigProps.getPurgePolicy() != null) { /* * New with jdbc 4.1 support, if the connection was aborted, skip the entire pool connection purge. */ boolean aborted = mcWrapper != null && mcWrapper.getManagedConnectionWithoutStateCheck() instanceof WSManagedConnection && ((WSManagedConnection) mcWrapper.getManagedConnectionWithoutStateCheck()).isAborted(); if (gConfigProps.getPurgePolicy() == PurgePolicy.EntirePool && !aborted) { // The remove parked connection code was delete here // Reset fatalErrorNotificationTime and remove all free connections ArrayList<MCWrapper> destroyMCWrappeList = new ArrayList<MCWrapper>(); synchronized (destroyMCWrapperListLock) { for (int j = 0; j < gConfigProps.getMaxFreePoolHashSize(); ++j) { // ffdc uses this method ,,, and was locking freepool // without locking // waiter pool first, causing a deadlock. synchronized (waiterFreePoolLock) { synchronized (freePool[j].freeConnectionLockObject) { /* * If a connection gets away, by setting * fatalErrorNotificationTime will guaranty when the * connection is returned to the free pool, it will be */ freePool[j].incrementFatalErrorValue(j); /* * Move as many connections as we can in the free pool to * the destroy list */ if (freePool[j].mcWrapperList.size() > 0) { // freePool[j].removeCleanupAndDestroyAllFreeConnections(); int mcWrapperListIndex = freePool[j].mcWrapperList.size() - 1; for (int k = mcWrapperListIndex; k >= 0; --k) { MCWrapper mcw = (MCWrapper) freePool[j].mcWrapperList.remove(k); mcw.setPoolState(0); destroyMCWrappeList.add(mcw); --freePool[j].numberOfConnectionsAssignedToThisFreePool; } } // end if } // end free lock } // end waiter lock } // end for j } // end syc for destroyMCWrapperListLock /* * we need to cleanup and destroy connections in the local * destroy list. */ for (int i = 0; i < destroyMCWrappeList.size(); ++i) { MCWrapper mcw = destroyMCWrappeList.get(i); freePool[0].cleanupAndDestroyMCWrapper(mcw); this.totalConnectionCount.decrementAndGet(); } } // end "EntirePool" purge policy else { /* * We only need to check for the validating mcf support if purge * policy is not "EntirePool" If the purge policy is "EntierPool" all * of the connection will be destroyed. We will have no connection to * validate. * * If ValidatingMCFSupported == true this code will attempt to cleanup * and destroy the connections returned by the method * getInvalidConnections(). * * If the connection is active, the connections will be marked stale. * * New with jdbc 4.1 support, if the connection was aborted, skip the validate connections call. */ if (gConfigProps.validatingMCFSupported && !aborted) { validateConnections(managedConnectionFactory, false); } /* * Mark all connections to be pretested for * purge policy = ValidateAllConnections. If pretest fails a new * connection will be created. Moved to here and corrected to avoid * marking empty wrappers -- * */ if (gConfigProps.getPurgePolicy() == PurgePolicy.ValidateAllConnections) { mcToMCWMapWrite.lock(); try { Collection<MCWrapper> s = mcToMCWMap.values(); Iterator<MCWrapper> i = s.iterator(); while (i.hasNext()) { com.ibm.ejs.j2c.MCWrapper mcw = (com.ibm.ejs.j2c.MCWrapper) i.next(); if (mcw.getState() != com.ibm.ejs.j2c.MCWrapper.STATE_INACTIVE) { mcw.setPretestThisConnection(true); } } } finally { mcToMCWMapWrite.unlock(); } } } // end of PurgePolicy NOT EntirePool } // end of PurgePolicy not null } // end of connection pooling enabled else { /* * * Connection pooling in the free pool is disabled. No other proccessing * in this method is needed. */ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "Pooling disabled, fatal error processing completed."); } } activeRequest.decrementAndGet(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(this, tc, "fatalErrorNotification"); } } }
public class class_name { public void fatalErrorNotification(ManagedConnectionFactory managedConnectionFactory, MCWrapper mcWrapper, Object affinity) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(this, tc, "fatalErrorNotification"); // depends on control dependency: [if], data = [none] } requestingAccessToPool(); if (mcWrapper != null) { mcWrapper.markStale(); // depends on control dependency: [if], data = [none] } if (gConfigProps.connectionPoolingEnabled) { if (gConfigProps.getPurgePolicy() != null) { /* * New with jdbc 4.1 support, if the connection was aborted, skip the entire pool connection purge. */ boolean aborted = mcWrapper != null && mcWrapper.getManagedConnectionWithoutStateCheck() instanceof WSManagedConnection && ((WSManagedConnection) mcWrapper.getManagedConnectionWithoutStateCheck()).isAborted(); if (gConfigProps.getPurgePolicy() == PurgePolicy.EntirePool && !aborted) { // The remove parked connection code was delete here // Reset fatalErrorNotificationTime and remove all free connections ArrayList<MCWrapper> destroyMCWrappeList = new ArrayList<MCWrapper>(); synchronized (destroyMCWrapperListLock) { // depends on control dependency: [if], data = [none] for (int j = 0; j < gConfigProps.getMaxFreePoolHashSize(); ++j) { // ffdc uses this method ,,, and was locking freepool // without locking // waiter pool first, causing a deadlock. synchronized (waiterFreePoolLock) { // depends on control dependency: [for], data = [none] synchronized (freePool[j].freeConnectionLockObject) { /* * If a connection gets away, by setting * fatalErrorNotificationTime will guaranty when the * connection is returned to the free pool, it will be */ freePool[j].incrementFatalErrorValue(j); /* * Move as many connections as we can in the free pool to * the destroy list */ if (freePool[j].mcWrapperList.size() > 0) { // freePool[j].removeCleanupAndDestroyAllFreeConnections(); int mcWrapperListIndex = freePool[j].mcWrapperList.size() - 1; for (int k = mcWrapperListIndex; k >= 0; --k) { MCWrapper mcw = (MCWrapper) freePool[j].mcWrapperList.remove(k); mcw.setPoolState(0); // depends on control dependency: [for], data = [none] destroyMCWrappeList.add(mcw); // depends on control dependency: [for], data = [none] --freePool[j].numberOfConnectionsAssignedToThisFreePool; // depends on control dependency: [for], data = [none] } } // end if } // end free lock } // end waiter lock } // end for j } // end syc for destroyMCWrapperListLock /* * we need to cleanup and destroy connections in the local * destroy list. */ for (int i = 0; i < destroyMCWrappeList.size(); ++i) { MCWrapper mcw = destroyMCWrappeList.get(i); freePool[0].cleanupAndDestroyMCWrapper(mcw); // depends on control dependency: [for], data = [none] this.totalConnectionCount.decrementAndGet(); // depends on control dependency: [for], data = [none] } } // end "EntirePool" purge policy else { /* * We only need to check for the validating mcf support if purge * policy is not "EntirePool" If the purge policy is "EntierPool" all * of the connection will be destroyed. We will have no connection to * validate. * * If ValidatingMCFSupported == true this code will attempt to cleanup * and destroy the connections returned by the method * getInvalidConnections(). * * If the connection is active, the connections will be marked stale. * * New with jdbc 4.1 support, if the connection was aborted, skip the validate connections call. */ if (gConfigProps.validatingMCFSupported && !aborted) { validateConnections(managedConnectionFactory, false); // depends on control dependency: [if], data = [none] } /* * Mark all connections to be pretested for * purge policy = ValidateAllConnections. If pretest fails a new * connection will be created. Moved to here and corrected to avoid * marking empty wrappers -- * */ if (gConfigProps.getPurgePolicy() == PurgePolicy.ValidateAllConnections) { mcToMCWMapWrite.lock(); // depends on control dependency: [if], data = [none] try { Collection<MCWrapper> s = mcToMCWMap.values(); Iterator<MCWrapper> i = s.iterator(); while (i.hasNext()) { com.ibm.ejs.j2c.MCWrapper mcw = (com.ibm.ejs.j2c.MCWrapper) i.next(); if (mcw.getState() != com.ibm.ejs.j2c.MCWrapper.STATE_INACTIVE) { mcw.setPretestThisConnection(true); // depends on control dependency: [if], data = [none] } } } finally { mcToMCWMapWrite.unlock(); } } } // end of PurgePolicy NOT EntirePool } // end of PurgePolicy not null } // end of connection pooling enabled else { /* * * Connection pooling in the free pool is disabled. No other proccessing * in this method is needed. */ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "Pooling disabled, fatal error processing completed."); // depends on control dependency: [if], data = [none] } } activeRequest.decrementAndGet(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(this, tc, "fatalErrorNotification"); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void copyGrammarOutput (final File sourceRoot, final String packageName, final File tempDirectory, final String updatePattern) throws MojoExecutionException { try { final List <File> tempFiles = FileUtils.getFiles (tempDirectory, "*.java", null); for (final File tempFile : tempFiles) { String outputPath = ""; if (packageName.length () > 0) { outputPath = packageName.replace ('.', '/') + '/'; } outputPath += tempFile.getName (); final File outputFile = new File (sourceRoot, outputPath); final File sourceFile = findSourceFile (outputPath); boolean alwaysUpdate = false; if (updatePattern != null && sourceFile != null) { if (updatePattern.startsWith ("!")) { alwaysUpdate = !SelectorUtils.match (updatePattern.substring (1), tempFile.getName ()); } else { alwaysUpdate = SelectorUtils.match (updatePattern, tempFile.getName ()); } } if (sourceFile == null || (alwaysUpdate && sourceFile.equals (outputFile))) { getLog ().debug ("Copying generated file: " + outputPath); try { FileUtils.copyFile (tempFile, outputFile); } catch (final IOException e) { throw new MojoExecutionException ("Failed to copy generated source file to output directory:" + tempFile + " -> " + outputFile, e); } } else { getLog ().debug ("Skipping customized file: " + outputPath); } } } catch (final IOException e) { throw new MojoExecutionException ("Failed to copy generated source files", e); } } }
public class class_name { protected void copyGrammarOutput (final File sourceRoot, final String packageName, final File tempDirectory, final String updatePattern) throws MojoExecutionException { try { final List <File> tempFiles = FileUtils.getFiles (tempDirectory, "*.java", null); for (final File tempFile : tempFiles) { String outputPath = ""; if (packageName.length () > 0) { outputPath = packageName.replace ('.', '/') + '/'; // depends on control dependency: [if], data = [none] } outputPath += tempFile.getName (); final File outputFile = new File (sourceRoot, outputPath); final File sourceFile = findSourceFile (outputPath); boolean alwaysUpdate = false; if (updatePattern != null && sourceFile != null) { if (updatePattern.startsWith ("!")) { alwaysUpdate = !SelectorUtils.match (updatePattern.substring (1), tempFile.getName ()); // depends on control dependency: [if], data = [none] } else { alwaysUpdate = SelectorUtils.match (updatePattern, tempFile.getName ()); // depends on control dependency: [if], data = [none] } } if (sourceFile == null || (alwaysUpdate && sourceFile.equals (outputFile))) { getLog ().debug ("Copying generated file: " + outputPath); // depends on control dependency: [if], data = [none] try { FileUtils.copyFile (tempFile, outputFile); // depends on control dependency: [try], data = [none] } catch (final IOException e) { throw new MojoExecutionException ("Failed to copy generated source file to output directory:" + tempFile + " -> " + outputFile, e); } // depends on control dependency: [catch], data = [none] } else { getLog ().debug ("Skipping customized file: " + outputPath); // depends on control dependency: [if], data = [none] } } } catch (final IOException e) { throw new MojoExecutionException ("Failed to copy generated source files", e); } } }
public class class_name { private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; lookAndFeelLabel = new javax.swing.JLabel(); lookAndFeelComboBox = new javax.swing.JComboBox(); // Look and Feel String landfCurrent = (String)properties.get(ScreenUtil.LOOK_AND_FEEL); if (landfCurrent == null) landfCurrent = ScreenUtil.DEFAULT; mapLAndF = new HashMap<String,String>(); ScreenDialog.addLookAndFeelItem(mapLAndF, java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString(ScreenUtil.DEFAULT), ScreenUtil.DEFAULT, landfCurrent, lookAndFeelComboBox); ScreenDialog.addLookAndFeelItem(mapLAndF, java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString(ScreenUtil.SYSTEM), ScreenUtil.SYSTEM, landfCurrent, lookAndFeelComboBox); UIManager.LookAndFeelInfo[] rgLandFInfo = UIManager.getInstalledLookAndFeels(); for (int i = 0; i < rgLandFInfo.length; i++) { ScreenDialog.addLookAndFeelItem(mapLAndF, rgLandFInfo[i].getName(), rgLandFInfo[i].getClassName(), landfCurrent, lookAndFeelComboBox); } LookAndFeel[] rgLandF = UIManager.getAuxiliaryLookAndFeels(); if (rgLandF != null) { for (int i = 0; i < rgLandF.length; i++) { ScreenDialog.addLookAndFeelItem(mapLAndF, rgLandF[i].getName(), rgLandF[i].getClass().getName(), landfCurrent, lookAndFeelComboBox); } } themeLabel = new javax.swing.JLabel(); themeComboBox = new javax.swing.JComboBox(); String currentThemeName = (String)properties.get(ScreenUtil.THEME); if (currentThemeName == null) currentThemeName = ScreenUtil.DEFAULT; mapThemes = new HashMap<String,String>(); ScreenDialog.addThemeItem(mapThemes, java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString(ScreenUtil.DEFAULT), ScreenUtil.DEFAULT, null, currentThemeName, themeComboBox); ScreenDialog.addThemeItem(mapThemes, null, null, new BlueTheme(), currentThemeName, themeComboBox); ScreenDialog.addThemeItem(mapThemes, null, null, new GrayTheme(), currentThemeName, themeComboBox); ScreenDialog.addThemeItem(mapThemes, null, null, new RedTheme(), currentThemeName, themeComboBox); ScreenDialog.addThemeItem(mapThemes, null, null, new OceanTheme(), currentThemeName, themeComboBox); fontLabel = new javax.swing.JLabel(); fontComboBox = new javax.swing.JComboBox(); // Font String currentFontName = (String)properties.get(ScreenUtil.FONT_NAME); Toolkit toolkit = Toolkit.getDefaultToolkit(); fontComboBox.addItem(this.getDefaultText()); fontComboBox.setSelectedIndex(0); if (toolkit != null) { String[] astrFont = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); //toolkit.getFontList(); for (int i = 0; i < astrFont.length; i++) { fontComboBox.addItem(astrFont[i]); if (astrFont[i].equals(currentFontName)) fontComboBox.setSelectedItem(astrFont[i]); // To select the correct object } } sizeLabel = new javax.swing.JLabel(); sizeComboBox = new javax.swing.JComboBox(); // Size String currentFontSize = (String)properties.get(ScreenUtil.FONT_SIZE); String rgSizes[] = {"6", "8", "10", "12", "14", "18", "22", "28"}; sizeComboBox.addItem(getDefaultText()); sizeComboBox.setSelectedIndex(0); for (int i = 0; i < rgSizes.length; i++) { sizeComboBox.addItem(rgSizes[i]); if (rgSizes[i].equals(currentFontSize)) sizeComboBox.setSelectedItem(rgSizes[i]); // To select the correct object } colorPanel = new javax.swing.JPanel(); textColorButton = new javax.swing.JButton(); controlColorButton = new javax.swing.JButton(); backgroundButton = new javax.swing.JButton(); samplePanel = new javax.swing.JPanel(); sampleLabel = new javax.swing.JLabel(); sampleTextField = new javax.swing.JTextField(); buttonPanel = new javax.swing.JPanel(); okButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); resetButton = new javax.swing.JButton(); getContentPane().setLayout(new java.awt.GridBagLayout()); setTitle(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("title")); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); lookAndFeelLabel.setLabelFor(lookAndFeelComboBox); lookAndFeelLabel.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("landf")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.5; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(lookAndFeelLabel, gridBagConstraints); lookAndFeelComboBox.setEditable(true); lookAndFeelComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateLookAndFeel(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.5; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(lookAndFeelComboBox, gridBagConstraints); themeLabel.setLabelFor(themeComboBox); themeLabel.setText("Theme:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(themeLabel, gridBagConstraints); themeLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("theme")); themeComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { themeComboBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(themeComboBox, gridBagConstraints); fontLabel.setLabelFor(fontComboBox); fontLabel.setText("Font:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(fontLabel, gridBagConstraints); fontLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("font")); fontComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fontComboBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(fontComboBox, gridBagConstraints); sizeLabel.setLabelFor(sizeComboBox); sizeLabel.setText("Size:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(sizeLabel, gridBagConstraints); sizeLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("size")); sizeComboBox.setEditable(true); sizeComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sizeComboBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(sizeComboBox, gridBagConstraints); colorPanel.setLayout(new java.awt.GridBagLayout()); textColorButton.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("textcolor")); textColorButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { textColorButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); colorPanel.add(textColorButton, gridBagConstraints); controlColorButton.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("controlcolor")); controlColorButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { controlColorButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); colorPanel.add(controlColorButton, gridBagConstraints); backgroundButton.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("backgroundcolor")); backgroundButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { backgroundButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); colorPanel.add(backgroundButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; getContentPane().add(colorPanel, gridBagConstraints); samplePanel.setLayout(new java.awt.GridBagLayout()); samplePanel.setBorder(new javax.swing.border.TitledBorder(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("sample"))); sampleLabel.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("label")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); samplePanel.add(sampleLabel, gridBagConstraints); sampleTextField.setColumns(10); sampleTextField.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("control")); sampleTextField.setMinimumSize(new java.awt.Dimension(50, 19)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); samplePanel.add(sampleTextField, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE; gridBagConstraints.weightx = 0.5; getContentPane().add(samplePanel, gridBagConstraints); buttonPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); okButton.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("ok")); okButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okButtonActionPerformed(evt); } }); buttonPanel.add(okButton); cancelButton.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("cancel")); cancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); buttonPanel.add(cancelButton); resetButton.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("reset")); resetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resetButtonActionPerformed(evt); } }); buttonPanel.add(resetButton); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH; getContentPane().add(buttonPanel, gridBagConstraints); pack(); } }
public class class_name { private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; lookAndFeelLabel = new javax.swing.JLabel(); lookAndFeelComboBox = new javax.swing.JComboBox(); // Look and Feel String landfCurrent = (String)properties.get(ScreenUtil.LOOK_AND_FEEL); if (landfCurrent == null) landfCurrent = ScreenUtil.DEFAULT; mapLAndF = new HashMap<String,String>(); ScreenDialog.addLookAndFeelItem(mapLAndF, java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString(ScreenUtil.DEFAULT), ScreenUtil.DEFAULT, landfCurrent, lookAndFeelComboBox); ScreenDialog.addLookAndFeelItem(mapLAndF, java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString(ScreenUtil.SYSTEM), ScreenUtil.SYSTEM, landfCurrent, lookAndFeelComboBox); UIManager.LookAndFeelInfo[] rgLandFInfo = UIManager.getInstalledLookAndFeels(); for (int i = 0; i < rgLandFInfo.length; i++) { ScreenDialog.addLookAndFeelItem(mapLAndF, rgLandFInfo[i].getName(), rgLandFInfo[i].getClassName(), landfCurrent, lookAndFeelComboBox); // depends on control dependency: [for], data = [i] } LookAndFeel[] rgLandF = UIManager.getAuxiliaryLookAndFeels(); if (rgLandF != null) { for (int i = 0; i < rgLandF.length; i++) { ScreenDialog.addLookAndFeelItem(mapLAndF, rgLandF[i].getName(), rgLandF[i].getClass().getName(), landfCurrent, lookAndFeelComboBox); // depends on control dependency: [for], data = [i] } } themeLabel = new javax.swing.JLabel(); themeComboBox = new javax.swing.JComboBox(); String currentThemeName = (String)properties.get(ScreenUtil.THEME); if (currentThemeName == null) currentThemeName = ScreenUtil.DEFAULT; mapThemes = new HashMap<String,String>(); ScreenDialog.addThemeItem(mapThemes, java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString(ScreenUtil.DEFAULT), ScreenUtil.DEFAULT, null, currentThemeName, themeComboBox); ScreenDialog.addThemeItem(mapThemes, null, null, new BlueTheme(), currentThemeName, themeComboBox); ScreenDialog.addThemeItem(mapThemes, null, null, new GrayTheme(), currentThemeName, themeComboBox); ScreenDialog.addThemeItem(mapThemes, null, null, new RedTheme(), currentThemeName, themeComboBox); ScreenDialog.addThemeItem(mapThemes, null, null, new OceanTheme(), currentThemeName, themeComboBox); fontLabel = new javax.swing.JLabel(); fontComboBox = new javax.swing.JComboBox(); // Font String currentFontName = (String)properties.get(ScreenUtil.FONT_NAME); Toolkit toolkit = Toolkit.getDefaultToolkit(); fontComboBox.addItem(this.getDefaultText()); fontComboBox.setSelectedIndex(0); if (toolkit != null) { String[] astrFont = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); //toolkit.getFontList(); for (int i = 0; i < astrFont.length; i++) { fontComboBox.addItem(astrFont[i]); // depends on control dependency: [for], data = [i] if (astrFont[i].equals(currentFontName)) fontComboBox.setSelectedItem(astrFont[i]); // To select the correct object } } sizeLabel = new javax.swing.JLabel(); sizeComboBox = new javax.swing.JComboBox(); // Size String currentFontSize = (String)properties.get(ScreenUtil.FONT_SIZE); String rgSizes[] = {"6", "8", "10", "12", "14", "18", "22", "28"}; sizeComboBox.addItem(getDefaultText()); sizeComboBox.setSelectedIndex(0); for (int i = 0; i < rgSizes.length; i++) { sizeComboBox.addItem(rgSizes[i]); // depends on control dependency: [for], data = [i] if (rgSizes[i].equals(currentFontSize)) sizeComboBox.setSelectedItem(rgSizes[i]); // To select the correct object } colorPanel = new javax.swing.JPanel(); textColorButton = new javax.swing.JButton(); controlColorButton = new javax.swing.JButton(); backgroundButton = new javax.swing.JButton(); samplePanel = new javax.swing.JPanel(); sampleLabel = new javax.swing.JLabel(); sampleTextField = new javax.swing.JTextField(); buttonPanel = new javax.swing.JPanel(); okButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); resetButton = new javax.swing.JButton(); getContentPane().setLayout(new java.awt.GridBagLayout()); setTitle(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("title")); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); lookAndFeelLabel.setLabelFor(lookAndFeelComboBox); lookAndFeelLabel.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("landf")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.5; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(lookAndFeelLabel, gridBagConstraints); lookAndFeelComboBox.setEditable(true); lookAndFeelComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateLookAndFeel(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.5; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(lookAndFeelComboBox, gridBagConstraints); themeLabel.setLabelFor(themeComboBox); themeLabel.setText("Theme:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(themeLabel, gridBagConstraints); themeLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("theme")); themeComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { themeComboBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(themeComboBox, gridBagConstraints); fontLabel.setLabelFor(fontComboBox); fontLabel.setText("Font:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(fontLabel, gridBagConstraints); fontLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("font")); fontComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fontComboBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(fontComboBox, gridBagConstraints); sizeLabel.setLabelFor(sizeComboBox); sizeLabel.setText("Size:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(sizeLabel, gridBagConstraints); sizeLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("size")); sizeComboBox.setEditable(true); sizeComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sizeComboBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(sizeComboBox, gridBagConstraints); colorPanel.setLayout(new java.awt.GridBagLayout()); textColorButton.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("textcolor")); textColorButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { textColorButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); colorPanel.add(textColorButton, gridBagConstraints); controlColorButton.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("controlcolor")); controlColorButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { controlColorButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); colorPanel.add(controlColorButton, gridBagConstraints); backgroundButton.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("backgroundcolor")); backgroundButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { backgroundButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); colorPanel.add(backgroundButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; getContentPane().add(colorPanel, gridBagConstraints); samplePanel.setLayout(new java.awt.GridBagLayout()); samplePanel.setBorder(new javax.swing.border.TitledBorder(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("sample"))); sampleLabel.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("label")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); samplePanel.add(sampleLabel, gridBagConstraints); sampleTextField.setColumns(10); sampleTextField.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("control")); sampleTextField.setMinimumSize(new java.awt.Dimension(50, 19)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); samplePanel.add(sampleTextField, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE; gridBagConstraints.weightx = 0.5; getContentPane().add(samplePanel, gridBagConstraints); buttonPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); okButton.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("ok")); okButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okButtonActionPerformed(evt); } }); buttonPanel.add(okButton); cancelButton.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("cancel")); cancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); buttonPanel.add(cancelButton); resetButton.setText(java.util.ResourceBundle.getBundle(DIALOG_BUNDLE).getString("reset")); resetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resetButtonActionPerformed(evt); } }); buttonPanel.add(resetButton); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH; getContentPane().add(buttonPanel, gridBagConstraints); pack(); } }
public class class_name { public static <T> T getAnnotation(final Class c, final Class<T> annotation) { final List<T> found = getAnnotations(c, annotation); if (found != null && !found.isEmpty()) { return found.get(0); } else { return null; } } }
public class class_name { public static <T> T getAnnotation(final Class c, final Class<T> annotation) { final List<T> found = getAnnotations(c, annotation); if (found != null && !found.isEmpty()) { return found.get(0); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public T remove() { lock.lock(); try { if(queue.isEmpty()) return null; El<T> el=queue.poll(); count-=el.size; not_full.signalAll(); return el.el; } finally { lock.unlock(); } } }
public class class_name { public T remove() { lock.lock(); try { if(queue.isEmpty()) return null; El<T> el=queue.poll(); count-=el.size; // depends on control dependency: [try], data = [none] not_full.signalAll(); // depends on control dependency: [try], data = [none] return el.el; // depends on control dependency: [try], data = [none] } finally { lock.unlock(); } } }
public class class_name { public double distance (Vector3 point) { double distance = -Float.MAX_VALUE; for (Plane plane : _planes) { distance = Math.max(distance, plane.distance(point)); } return distance; } }
public class class_name { public double distance (Vector3 point) { double distance = -Float.MAX_VALUE; for (Plane plane : _planes) { distance = Math.max(distance, plane.distance(point)); // depends on control dependency: [for], data = [plane] } return distance; } }
public class class_name { private static Constructor<?> getConstructor(final Class<?> genericClass, final Class<?>[] constructorParameterTypes) { Constructor<?> constructor = null; try { constructor = genericClass.getConstructor(constructorParameterTypes); } catch (final NoSuchMethodException e) { // Return the first constructor as a workaround constructor = genericClass.getConstructors()[0]; } catch (final SecurityException e) { LOGGER.log(NO_CONSTRUCTOR, e); throw e; // Pop up the exception to let it managed by the caller method } return constructor; } }
public class class_name { private static Constructor<?> getConstructor(final Class<?> genericClass, final Class<?>[] constructorParameterTypes) { Constructor<?> constructor = null; try { constructor = genericClass.getConstructor(constructorParameterTypes); // depends on control dependency: [try], data = [none] } catch (final NoSuchMethodException e) { // Return the first constructor as a workaround constructor = genericClass.getConstructors()[0]; } catch (final SecurityException e) { // depends on control dependency: [catch], data = [none] LOGGER.log(NO_CONSTRUCTOR, e); throw e; // Pop up the exception to let it managed by the caller method } // depends on control dependency: [catch], data = [none] return constructor; } }
public class class_name { public static void stop(Service service) { if (service != null) { Service.STATE state = service.getServiceState(); if (state == Service.STATE.STARTED) { service.stop(); } } } }
public class class_name { public static void stop(Service service) { if (service != null) { Service.STATE state = service.getServiceState(); if (state == Service.STATE.STARTED) { service.stop(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String regex = this.getProperty(REGEX); String server = req.getServerName(); if (regex != null) if (server != null) { String match = null; if (regex.indexOf('/') != -1) { match = regex.substring(regex.indexOf('/')); regex = regex.substring(0, regex.indexOf('/')); } if (server.matches(regex)) { String target = this.getProperty(REGEX_TARGET); if (target != null) { if (logger != null) logger.info("Redirect " + server + " to " + target); String requestPath = req.getServletPath(); if ((match == null) || (requestPath.matches(match))) res.sendRedirect(target); else { boolean fileFound = sendResourceFile(req, res); if (!fileFound) res.sendError(HttpServletResponse.SC_NOT_FOUND, "File not found"); } return; } } } super.service(req, res); } }
public class class_name { public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String regex = this.getProperty(REGEX); String server = req.getServerName(); if (regex != null) if (server != null) { String match = null; if (regex.indexOf('/') != -1) { match = regex.substring(regex.indexOf('/')); // depends on control dependency: [if], data = [(regex.indexOf('/')] regex = regex.substring(0, regex.indexOf('/')); // depends on control dependency: [if], data = [none] } if (server.matches(regex)) { String target = this.getProperty(REGEX_TARGET); if (target != null) { if (logger != null) logger.info("Redirect " + server + " to " + target); String requestPath = req.getServletPath(); if ((match == null) || (requestPath.matches(match))) res.sendRedirect(target); else { boolean fileFound = sendResourceFile(req, res); if (!fileFound) res.sendError(HttpServletResponse.SC_NOT_FOUND, "File not found"); } return; // depends on control dependency: [if], data = [none] } } } super.service(req, res); } }
public class class_name { public int doMove(int iRelPosition) throws DBException { // Note: actually, I should check if (iRelPos == FIRST) rec.moveFirst(), // but, I use the same constants for First/Last as JDBC if (this.getRecord().getDefaultOrder() != m_iLastOrder) { // Order was changed int iCurrentRow = -1; if (m_iLastOrder == -1) iCurrentRow = m_iRow; // Special case... A seek was done between the last read, so I need to return to the current row instead of the first row this.setResultSet(null, DBConstants.SQL_SELECT_TYPE); if (iCurrentRow != -1) if (iRelPosition != DBConstants.FIRST_RECORD) if (iRelPosition != DBConstants.LAST_RECORD) iRelPosition = iRelPosition + iCurrentRow + 1; // Special case... This will set the target position to the correct (next) row m_iLastOrder = this.getRecord().getDefaultOrder(); m_iEOFRow = Integer.MAX_VALUE; } if ((iRelPosition == DBConstants.PREVIOUS_RECORD) && (m_iRow == -1)) iRelPosition = DBConstants.LAST_RECORD; int iTargetPosition = m_iRow + iRelPosition; if (iRelPosition == DBConstants.FIRST_RECORD) iTargetPosition = 0; // First Record if (iRelPosition == DBConstants.LAST_RECORD) iTargetPosition = m_iEOFRow; // Last Record if (m_iRow != -1) if (iTargetPosition != -1) if (iTargetPosition <= m_iRow) this.setResultSet(null, DBConstants.SQL_SELECT_TYPE); // Have to start from the beginning // Do the move ResultSet resultSet = (ResultSet)this.getResultSet(); try { if ((resultSet == null) || (resultSet.isClosed())) { Vector<BaseField> vParamList = new Vector<BaseField>(); String strRecordset = this.getRecord().getSQLQuery( SQLParams.USE_SELECT_LITERALS, vParamList); resultSet = this.executeQuery(strRecordset, DBConstants.SQL_SELECT_TYPE, vParamList); this.setResultSet(resultSet, DBConstants.SQL_SELECT_TYPE); vParamList.removeAllElements(); } } catch (Exception e) { e.printStackTrace(); // Never if (e instanceof DBException) throw (DBException)e; } if (iRelPosition == DBConstants.LAST_RECORD) if (m_iEOFRow == Integer.MAX_VALUE) { // Haven't found EOF yet... find it. iTargetPosition = m_iEOFRow; // Last Record this.readNextToTarget(iTargetPosition, iRelPosition); // Get EOF iTargetPosition = m_iEOFRow; // Move to last row Vector<BaseField> vParamList = new Vector<BaseField>(); String strRecordset = this.getRecord().getSQLQuery(SQLParams.USE_SELECT_LITERALS, vParamList); resultSet = this.executeQuery(strRecordset, DBConstants.SQL_SELECT_TYPE, vParamList); this.setResultSet(resultSet, DBConstants.SQL_SELECT_TYPE); vParamList.removeAllElements(); } int iRecordStatus = this.readNextToTarget(iTargetPosition, iRelPosition); // Done! if (m_iRow != iTargetPosition) { if (iTargetPosition < 0) if (m_iRow == -1) iRecordStatus |= DBConstants.RECORD_AT_BOF; if (CLEANUP_STATEMENTS) this.setResultSet(null, DBConstants.SQL_SELECT_TYPE); // Close this statement (at EOF) } return iRecordStatus; } }
public class class_name { public int doMove(int iRelPosition) throws DBException { // Note: actually, I should check if (iRelPos == FIRST) rec.moveFirst(), // but, I use the same constants for First/Last as JDBC if (this.getRecord().getDefaultOrder() != m_iLastOrder) { // Order was changed int iCurrentRow = -1; if (m_iLastOrder == -1) iCurrentRow = m_iRow; // Special case... A seek was done between the last read, so I need to return to the current row instead of the first row this.setResultSet(null, DBConstants.SQL_SELECT_TYPE); if (iCurrentRow != -1) if (iRelPosition != DBConstants.FIRST_RECORD) if (iRelPosition != DBConstants.LAST_RECORD) iRelPosition = iRelPosition + iCurrentRow + 1; // Special case... This will set the target position to the correct (next) row m_iLastOrder = this.getRecord().getDefaultOrder(); m_iEOFRow = Integer.MAX_VALUE; } if ((iRelPosition == DBConstants.PREVIOUS_RECORD) && (m_iRow == -1)) iRelPosition = DBConstants.LAST_RECORD; int iTargetPosition = m_iRow + iRelPosition; if (iRelPosition == DBConstants.FIRST_RECORD) iTargetPosition = 0; // First Record if (iRelPosition == DBConstants.LAST_RECORD) iTargetPosition = m_iEOFRow; // Last Record if (m_iRow != -1) if (iTargetPosition != -1) if (iTargetPosition <= m_iRow) this.setResultSet(null, DBConstants.SQL_SELECT_TYPE); // Have to start from the beginning // Do the move ResultSet resultSet = (ResultSet)this.getResultSet(); try { if ((resultSet == null) || (resultSet.isClosed())) { Vector<BaseField> vParamList = new Vector<BaseField>(); String strRecordset = this.getRecord().getSQLQuery( SQLParams.USE_SELECT_LITERALS, vParamList); resultSet = this.executeQuery(strRecordset, DBConstants.SQL_SELECT_TYPE, vParamList); // depends on control dependency: [if], data = [none] this.setResultSet(resultSet, DBConstants.SQL_SELECT_TYPE); // depends on control dependency: [if], data = [none] vParamList.removeAllElements(); // depends on control dependency: [if], data = [none] } } catch (Exception e) { e.printStackTrace(); // Never if (e instanceof DBException) throw (DBException)e; } if (iRelPosition == DBConstants.LAST_RECORD) if (m_iEOFRow == Integer.MAX_VALUE) { // Haven't found EOF yet... find it. iTargetPosition = m_iEOFRow; // Last Record this.readNextToTarget(iTargetPosition, iRelPosition); // Get EOF iTargetPosition = m_iEOFRow; // Move to last row Vector<BaseField> vParamList = new Vector<BaseField>(); String strRecordset = this.getRecord().getSQLQuery(SQLParams.USE_SELECT_LITERALS, vParamList); resultSet = this.executeQuery(strRecordset, DBConstants.SQL_SELECT_TYPE, vParamList); this.setResultSet(resultSet, DBConstants.SQL_SELECT_TYPE); vParamList.removeAllElements(); } int iRecordStatus = this.readNextToTarget(iTargetPosition, iRelPosition); // Done! if (m_iRow != iTargetPosition) { if (iTargetPosition < 0) if (m_iRow == -1) iRecordStatus |= DBConstants.RECORD_AT_BOF; if (CLEANUP_STATEMENTS) this.setResultSet(null, DBConstants.SQL_SELECT_TYPE); // Close this statement (at EOF) } return iRecordStatus; } }
public class class_name { void lazyCopy(JSMessageData original) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "lazyCopy", new Object[] { original }); synchronized (getMessageLockArtefact()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "lazyCopy locked dest ", new Object[] { getMessageLockArtefact() }); // This is the only occasion that we reach out and lock another message instance // but we work on the assumption that lazy copying is happening as part of // instantiation of a new message instance, so the potential for deadlocking // is nil, since no other thread knows about this instance and can not therefore // be concurrently supplying 'this' as the 'original' argument in another thread. synchronized (original.getMessageLockArtefact()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "lazyCopy locked source ", new Object[] { original.getMessageLockArtefact() }); // Copy common fields indirect = original.indirect; // If the message is assembled (i.e. we have a contents buffer) we share both the // buffer and the cache between original and copy. // If the message is unassembled (no contents buffer) we just share the cache. // In either case if a change later needs to be made to the shared portion we // will need to copy it before changing, so the shared flags is set to // indicate sharing exists between unrelated parts. if (original.contents == null) { contents = null; original.sharedCache = true; sharedCache = true; cache = original.cache; } else { original.sharedContents = true; sharedContents = true; contents = original.contents; original.sharedCache = true; sharedCache = true; cache = original.cache; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "lazyCopy unlocking source ", new Object[] { original.getMessageLockArtefact() }); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "lazyCopy unlocking dest ", new Object[] { getMessageLockArtefact() }); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "lazyCopy"); } }
public class class_name { void lazyCopy(JSMessageData original) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "lazyCopy", new Object[] { original }); synchronized (getMessageLockArtefact()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "lazyCopy locked dest ", new Object[] { getMessageLockArtefact() }); // This is the only occasion that we reach out and lock another message instance // but we work on the assumption that lazy copying is happening as part of // instantiation of a new message instance, so the potential for deadlocking // is nil, since no other thread knows about this instance and can not therefore // be concurrently supplying 'this' as the 'original' argument in another thread. synchronized (original.getMessageLockArtefact()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "lazyCopy locked source ", new Object[] { original.getMessageLockArtefact() }); // Copy common fields indirect = original.indirect; // If the message is assembled (i.e. we have a contents buffer) we share both the // buffer and the cache between original and copy. // If the message is unassembled (no contents buffer) we just share the cache. // In either case if a change later needs to be made to the shared portion we // will need to copy it before changing, so the shared flags is set to // indicate sharing exists between unrelated parts. if (original.contents == null) { contents = null; // depends on control dependency: [if], data = [none] original.sharedCache = true; // depends on control dependency: [if], data = [none] sharedCache = true; // depends on control dependency: [if], data = [none] cache = original.cache; // depends on control dependency: [if], data = [none] } else { original.sharedContents = true; // depends on control dependency: [if], data = [none] sharedContents = true; // depends on control dependency: [if], data = [none] contents = original.contents; // depends on control dependency: [if], data = [none] original.sharedCache = true; // depends on control dependency: [if], data = [none] sharedCache = true; // depends on control dependency: [if], data = [none] cache = original.cache; // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "lazyCopy unlocking source ", new Object[] { original.getMessageLockArtefact() }); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "lazyCopy unlocking dest ", new Object[] { getMessageLockArtefact() }); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "lazyCopy"); } }
public class class_name { public void scanControllers() { for (GVRCursorController controller : getCursorControllers()) { if (!controllers.contains(controller)) { controllers.add(controller); } if (controller.isConnected()) { addCursorController(controller); } } } }
public class class_name { public void scanControllers() { for (GVRCursorController controller : getCursorControllers()) { if (!controllers.contains(controller)) { controllers.add(controller); // depends on control dependency: [if], data = [none] } if (controller.isConnected()) { addCursorController(controller); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public final int size() { int overallSize = 0; if (subSets != null) { for (int i = 0; i < subSets.length; i++) { overallSize = overallSize + subSets[i].size(); } } return overallSize; } }
public class class_name { public final int size() { int overallSize = 0; if (subSets != null) { for (int i = 0; i < subSets.length; i++) { overallSize = overallSize + subSets[i].size(); // depends on control dependency: [for], data = [i] } } return overallSize; } }
public class class_name { public static State jsonObjectToState(JsonObject jsonObject, String... excludeKeys) { State state = new State(); List<String> excludeKeysList = excludeKeys == null ? Lists.<String>newArrayList() : Arrays.asList(excludeKeys); for (Map.Entry<String, JsonElement> jsonObjectEntry : jsonObject.entrySet()) { if (!excludeKeysList.contains(jsonObjectEntry.getKey())) { state.setProp(jsonObjectEntry.getKey(), jsonObjectEntry.getValue().getAsString()); } } return state; } }
public class class_name { public static State jsonObjectToState(JsonObject jsonObject, String... excludeKeys) { State state = new State(); List<String> excludeKeysList = excludeKeys == null ? Lists.<String>newArrayList() : Arrays.asList(excludeKeys); for (Map.Entry<String, JsonElement> jsonObjectEntry : jsonObject.entrySet()) { if (!excludeKeysList.contains(jsonObjectEntry.getKey())) { state.setProp(jsonObjectEntry.getKey(), jsonObjectEntry.getValue().getAsString()); // depends on control dependency: [if], data = [none] } } return state; } }
public class class_name { private static ConfigurationModule addAll(final ConfigurationModule conf, final OptionalParameter<String> param, final File folder) { ConfigurationModule result = conf; final File[] files = folder.listFiles(); if (files != null) { for (final File f : files) { if (f.canRead() && f.exists() && f.isFile()) { result = result.set(param, f.getAbsolutePath()); } } } return result; } }
public class class_name { private static ConfigurationModule addAll(final ConfigurationModule conf, final OptionalParameter<String> param, final File folder) { ConfigurationModule result = conf; final File[] files = folder.listFiles(); if (files != null) { for (final File f : files) { if (f.canRead() && f.exists() && f.isFile()) { result = result.set(param, f.getAbsolutePath()); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { private void applyL1Reg(final double eta_t, Vec x) { //apply l1 regularization if(lambda1 > 0) { l1U += eta_t*lambda1;//line 6: in Tsuruoka et al paper, figure 2 for(int k = 0; k < ws.length; k++) { final Vec w_k = ws[k]; final double[] l1Q_k = l1Q[k]; for(IndexValue iv : x) { final int i = iv.getIndex(); //see "APPLYPENALTY(i)" on line 15: from Figure 2 in Tsuruoka et al paper final double z = w_k.get(i); double newW_i = 0; if (z > 0) newW_i = Math.max(0, z - (l1U + l1Q_k[i])); else if(z < 0) newW_i = Math.min(0, z + (l1U - l1Q_k[i])); l1Q_k[i] += (newW_i - z); w_k.set(i, newW_i); } } } } }
public class class_name { private void applyL1Reg(final double eta_t, Vec x) { //apply l1 regularization if(lambda1 > 0) { l1U += eta_t*lambda1;//line 6: in Tsuruoka et al paper, figure 2 // depends on control dependency: [if], data = [none] for(int k = 0; k < ws.length; k++) { final Vec w_k = ws[k]; final double[] l1Q_k = l1Q[k]; for(IndexValue iv : x) { final int i = iv.getIndex(); //see "APPLYPENALTY(i)" on line 15: from Figure 2 in Tsuruoka et al paper final double z = w_k.get(i); double newW_i = 0; if (z > 0) newW_i = Math.max(0, z - (l1U + l1Q_k[i])); else if(z < 0) newW_i = Math.min(0, z + (l1U - l1Q_k[i])); l1Q_k[i] += (newW_i - z); // depends on control dependency: [for], data = [none] w_k.set(i, newW_i); // depends on control dependency: [for], data = [none] } } } } }
public class class_name { public static String arrayListToCSV(List<String> list) { StringBuilder csv = new StringBuilder(); for (String str : list) { csv.append(str); csv.append(","); } int lastIndex = csv.length() - 1; char last = csv.charAt(lastIndex); if (last == ',') { return csv.substring(0, lastIndex); } return csv.toString(); } }
public class class_name { public static String arrayListToCSV(List<String> list) { StringBuilder csv = new StringBuilder(); for (String str : list) { csv.append(str); // depends on control dependency: [for], data = [str] csv.append(","); // depends on control dependency: [for], data = [none] } int lastIndex = csv.length() - 1; char last = csv.charAt(lastIndex); if (last == ',') { return csv.substring(0, lastIndex); // depends on control dependency: [if], data = [none] } return csv.toString(); } }
public class class_name { static void openURL(String url) { try { openURL(new URL(url)); } catch (MalformedURLException ex) { Tools.showError(ex); } } }
public class class_name { static void openURL(String url) { try { openURL(new URL(url)); // depends on control dependency: [try], data = [none] } catch (MalformedURLException ex) { Tools.showError(ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public LabelAlphabet DefaultLabelAlphabet() { IAlphabet alphabet = null; if (!maps.containsKey(DefalutLabelName)) { maps.put(DefalutLabelName, new LabelAlphabet()); alphabet = maps.get(DefalutLabelName); }else { alphabet = maps.get(DefalutLabelName); if (!(alphabet instanceof LabelAlphabet)) { throw new ClassCastException(); } } return (LabelAlphabet) alphabet; } }
public class class_name { public LabelAlphabet DefaultLabelAlphabet() { IAlphabet alphabet = null; if (!maps.containsKey(DefalutLabelName)) { maps.put(DefalutLabelName, new LabelAlphabet()); // depends on control dependency: [if], data = [none] alphabet = maps.get(DefalutLabelName); // depends on control dependency: [if], data = [none] }else { alphabet = maps.get(DefalutLabelName); // depends on control dependency: [if], data = [none] if (!(alphabet instanceof LabelAlphabet)) { throw new ClassCastException(); } } return (LabelAlphabet) alphabet; } }
public class class_name { public static Info inv( final Variable A , ManagerTempVariables manager) { Info ret = new Info(); if( A instanceof VariableMatrix ) { final VariableMatrix output = manager.createMatrix(); ret.output = output; ret.op = new Operation("inv-m") { @Override public void process() { VariableMatrix mA = (VariableMatrix)A; output.matrix.reshape(mA.matrix.numRows, mA.matrix.numCols); if( !CommonOps_DDRM.invert(mA.matrix,output.matrix) ) throw new RuntimeException("Inverse failed!"); } }; } else { final VariableDouble output = manager.createDouble(); ret.output = output; ret.op = new Operation("inv-s") { @Override public void process() { VariableScalar mA = (VariableScalar)A; output.value = 1.0/mA.getDouble(); } }; } return ret; } }
public class class_name { public static Info inv( final Variable A , ManagerTempVariables manager) { Info ret = new Info(); if( A instanceof VariableMatrix ) { final VariableMatrix output = manager.createMatrix(); ret.output = output; // depends on control dependency: [if], data = [none] ret.op = new Operation("inv-m") { @Override public void process() { VariableMatrix mA = (VariableMatrix)A; output.matrix.reshape(mA.matrix.numRows, mA.matrix.numCols); if( !CommonOps_DDRM.invert(mA.matrix,output.matrix) ) throw new RuntimeException("Inverse failed!"); } }; // depends on control dependency: [if], data = [none] } else { final VariableDouble output = manager.createDouble(); ret.output = output; // depends on control dependency: [if], data = [none] ret.op = new Operation("inv-s") { @Override public void process() { VariableScalar mA = (VariableScalar)A; output.value = 1.0/mA.getDouble(); } }; // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { public static File createTempDirectory(String prefix) { File temp = null; try { temp = File.createTempFile(prefix != null ? prefix : "temp", Long.toString(System.nanoTime())); if (!(temp.delete())) { throw new IOException("Could not delete temp file: " + temp.getAbsolutePath()); } if (!(temp.mkdir())) { throw new IOException("Could not create temp directory: " + temp.getAbsolutePath()); } } catch (IOException e) { throw new DukeException("Unable to create temporary directory with prefix " + prefix, e); } return temp; } }
public class class_name { public static File createTempDirectory(String prefix) { File temp = null; try { temp = File.createTempFile(prefix != null ? prefix : "temp", Long.toString(System.nanoTime())); // depends on control dependency: [try], data = [none] if (!(temp.delete())) { throw new IOException("Could not delete temp file: " + temp.getAbsolutePath()); } if (!(temp.mkdir())) { throw new IOException("Could not create temp directory: " + temp.getAbsolutePath()); } } catch (IOException e) { throw new DukeException("Unable to create temporary directory with prefix " + prefix, e); } // depends on control dependency: [catch], data = [none] return temp; } }
public class class_name { public void setProperty(Property property) { // mValues could be null if this is being constructed piecemeal. Just record the // propertyName to be used later when setValues() is called if so. if (mValues != null) { PropertyValuesHolder valuesHolder = mValues[0]; String oldName = valuesHolder.getPropertyName(); valuesHolder.setProperty(property); mValuesMap.remove(oldName); mValuesMap.put(mPropertyName, valuesHolder); } if (mProperty != null) { mPropertyName = property.getName(); } mProperty = property; // New property/values/target should cause re-initialization prior to starting mInitialized = false; } }
public class class_name { public void setProperty(Property property) { // mValues could be null if this is being constructed piecemeal. Just record the // propertyName to be used later when setValues() is called if so. if (mValues != null) { PropertyValuesHolder valuesHolder = mValues[0]; String oldName = valuesHolder.getPropertyName(); valuesHolder.setProperty(property); // depends on control dependency: [if], data = [none] mValuesMap.remove(oldName); // depends on control dependency: [if], data = [none] mValuesMap.put(mPropertyName, valuesHolder); // depends on control dependency: [if], data = [none] } if (mProperty != null) { mPropertyName = property.getName(); // depends on control dependency: [if], data = [none] } mProperty = property; // New property/values/target should cause re-initialization prior to starting mInitialized = false; } }
public class class_name { public static void pushMessages(String queueURL, List<String> messages) { if (!StringUtils.isBlank(queueURL) && messages != null) { // only allow strings - ie JSON try { int j = 0; List<SendMessageBatchRequestEntry> msgs = new ArrayList<>(MAX_MESSAGES); for (int i = 0; i < messages.size(); i++) { String message = messages.get(i); if (!StringUtils.isBlank(message)) { msgs.add(new SendMessageBatchRequestEntry(). withMessageBody(message). withId(Integer.toString(i))); } if (++j >= MAX_MESSAGES || i == messages.size() - 1) { if (!msgs.isEmpty()) { getClient().sendMessageBatch(queueURL, msgs); msgs.clear(); } j = 0; } } } catch (AmazonServiceException ase) { logException(ase); } catch (AmazonClientException ace) { logger.error("Could not reach SQS. {}", ace.toString()); } } } }
public class class_name { public static void pushMessages(String queueURL, List<String> messages) { if (!StringUtils.isBlank(queueURL) && messages != null) { // only allow strings - ie JSON try { int j = 0; List<SendMessageBatchRequestEntry> msgs = new ArrayList<>(MAX_MESSAGES); for (int i = 0; i < messages.size(); i++) { String message = messages.get(i); if (!StringUtils.isBlank(message)) { msgs.add(new SendMessageBatchRequestEntry(). withMessageBody(message). withId(Integer.toString(i))); // depends on control dependency: [if], data = [none] } if (++j >= MAX_MESSAGES || i == messages.size() - 1) { if (!msgs.isEmpty()) { getClient().sendMessageBatch(queueURL, msgs); // depends on control dependency: [if], data = [none] msgs.clear(); // depends on control dependency: [if], data = [none] } j = 0; // depends on control dependency: [if], data = [none] } } } catch (AmazonServiceException ase) { logException(ase); } catch (AmazonClientException ace) { // depends on control dependency: [catch], data = [none] logger.error("Could not reach SQS. {}", ace.toString()); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void toAssocRateVector(Term t, CrossTable table, AssociationRate assocRateFunction, boolean normalize) { double assocRate; for(Entry coterm:t.getContext().getEntries()) { ContextData contextData = computeContextData(table, t, coterm.getCoTerm()); assocRate = assocRateFunction.getValue(contextData); t.getContext().setAssocRate(coterm.getCoTerm(), assocRate); } if(normalize) t.getContext().normalize(); } }
public class class_name { public void toAssocRateVector(Term t, CrossTable table, AssociationRate assocRateFunction, boolean normalize) { double assocRate; for(Entry coterm:t.getContext().getEntries()) { ContextData contextData = computeContextData(table, t, coterm.getCoTerm()); assocRate = assocRateFunction.getValue(contextData); // depends on control dependency: [for], data = [none] t.getContext().setAssocRate(coterm.getCoTerm(), assocRate); // depends on control dependency: [for], data = [coterm] } if(normalize) t.getContext().normalize(); } }
public class class_name { private StorageNode getStorageNode(String groupName) { if (null == groupName) { return trackerClient.getStoreStorage(); } else { return trackerClient.getStoreStorage(groupName); } } }
public class class_name { private StorageNode getStorageNode(String groupName) { if (null == groupName) { return trackerClient.getStoreStorage(); // depends on control dependency: [if], data = [none] } else { return trackerClient.getStoreStorage(groupName); // depends on control dependency: [if], data = [groupName)] } } }
public class class_name { public static byte[] getAudio24(AudioFrame frame) { BytePointer[] planes = frame.getPlanes(); SampleFormat format = frame.getAudioFormat().getSampleFormat(); int depth = getFormatDepth(format); int length = planes[0].limit() / depth; int channels = planes.length; byte[] samples = new byte[channels * length * 3]; for (int i = 0; i < channels; i++) { ByteBuffer buffer = planes[i].asByteBuffer(); int offset = i * channels; for (int j = 0, k = offset; j < length; j++) { long sample = quantize24(getValue(buffer, format, j * depth).doubleValue() * twoPower23); samples[k++] = (byte) (sample & 0xFF); samples[k++] = (byte) ((sample >> 8) & 0xFF); samples[k++] = (byte) ((sample >> 16) & 0xFF); // interleave k += 2 * (channels - 1); } } return samples; } }
public class class_name { public static byte[] getAudio24(AudioFrame frame) { BytePointer[] planes = frame.getPlanes(); SampleFormat format = frame.getAudioFormat().getSampleFormat(); int depth = getFormatDepth(format); int length = planes[0].limit() / depth; int channels = planes.length; byte[] samples = new byte[channels * length * 3]; for (int i = 0; i < channels; i++) { ByteBuffer buffer = planes[i].asByteBuffer(); int offset = i * channels; for (int j = 0, k = offset; j < length; j++) { long sample = quantize24(getValue(buffer, format, j * depth).doubleValue() * twoPower23); samples[k++] = (byte) (sample & 0xFF); // depends on control dependency: [for], data = [none] samples[k++] = (byte) ((sample >> 8) & 0xFF); // depends on control dependency: [for], data = [none] samples[k++] = (byte) ((sample >> 16) & 0xFF); // depends on control dependency: [for], data = [none] // interleave k += 2 * (channels - 1); // depends on control dependency: [for], data = [none] } } return samples; } }