code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static Method[] collectMethods(Class<?> c, int inclusiveModifiers, int exclusiveModifiers, Class<?> limitExclusive) { Set<Method> methods = new HashSet<Method>(); while (c != limitExclusive) { for (Method f : c.getDeclaredMethods()) { if (((f.getModifiers() & exclusiveModifiers) == 0) && ((f.getModifiers() & inclusiveModifiers) == inclusiveModifiers)) { methods.add(f); f.setAccessible(true); } } c = c.getSuperclass(); } return methods.toArray(new Method[]{}); } }
public class class_name { public static Method[] collectMethods(Class<?> c, int inclusiveModifiers, int exclusiveModifiers, Class<?> limitExclusive) { Set<Method> methods = new HashSet<Method>(); while (c != limitExclusive) { for (Method f : c.getDeclaredMethods()) { if (((f.getModifiers() & exclusiveModifiers) == 0) && ((f.getModifiers() & inclusiveModifiers) == inclusiveModifiers)) { methods.add(f); // depends on control dependency: [if], data = [none] f.setAccessible(true); // depends on control dependency: [if], data = [none] } } c = c.getSuperclass(); // depends on control dependency: [while], data = [none] } return methods.toArray(new Method[]{}); } }
public class class_name { public void printDataStartForm(PrintWriter out, int iPrintOptions) { String strRecordName = "norecord"; Record record = this.getMainRecord(); if (record != null) strRecordName = record.getTableNames(false); if ((iPrintOptions & HtmlConstants.MAIN_HEADING_SCREEN) == HtmlConstants.MAIN_HEADING_SCREEN) { out.println(Utility.startTag(XMLTags.HEADING)); out.println(Utility.startTag(XMLTags.FILE)); out.println(Utility.startTag(strRecordName)); } if ((iPrintOptions & HtmlConstants.MAIN_FOOTING_SCREEN) == HtmlConstants.MAIN_FOOTING_SCREEN) { out.println(Utility.startTag(XMLTags.FOOTING)); out.println(Utility.startTag(XMLTags.FILE)); out.println(Utility.startTag(strRecordName)); } if ((iPrintOptions & HtmlConstants.REPORT_SCREEN) != HtmlConstants.REPORT_SCREEN) out.println(Utility.startTag(XMLTags.DATA)); // If not a report } }
public class class_name { public void printDataStartForm(PrintWriter out, int iPrintOptions) { String strRecordName = "norecord"; Record record = this.getMainRecord(); if (record != null) strRecordName = record.getTableNames(false); if ((iPrintOptions & HtmlConstants.MAIN_HEADING_SCREEN) == HtmlConstants.MAIN_HEADING_SCREEN) { out.println(Utility.startTag(XMLTags.HEADING)); // depends on control dependency: [if], data = [none] out.println(Utility.startTag(XMLTags.FILE)); // depends on control dependency: [if], data = [none] out.println(Utility.startTag(strRecordName)); // depends on control dependency: [if], data = [none] } if ((iPrintOptions & HtmlConstants.MAIN_FOOTING_SCREEN) == HtmlConstants.MAIN_FOOTING_SCREEN) { out.println(Utility.startTag(XMLTags.FOOTING)); // depends on control dependency: [if], data = [none] out.println(Utility.startTag(XMLTags.FILE)); // depends on control dependency: [if], data = [none] out.println(Utility.startTag(strRecordName)); // depends on control dependency: [if], data = [none] } if ((iPrintOptions & HtmlConstants.REPORT_SCREEN) != HtmlConstants.REPORT_SCREEN) out.println(Utility.startTag(XMLTags.DATA)); // If not a report } }
public class class_name { public void inputWatermark(Watermark watermark, int channelIndex) { // ignore the input watermark if its input channel, or all input channels are idle (i.e. overall the valve is idle). if (lastOutputStreamStatus.isActive() && channelStatuses[channelIndex].streamStatus.isActive()) { long watermarkMillis = watermark.getTimestamp(); // if the input watermark's value is less than the last received watermark for its input channel, ignore it also. if (watermarkMillis > channelStatuses[channelIndex].watermark) { channelStatuses[channelIndex].watermark = watermarkMillis; // previously unaligned input channels are now aligned if its watermark has caught up if (!channelStatuses[channelIndex].isWatermarkAligned && watermarkMillis >= lastOutputWatermark) { channelStatuses[channelIndex].isWatermarkAligned = true; } // now, attempt to find a new min watermark across all aligned channels findAndOutputNewMinWatermarkAcrossAlignedChannels(); } } } }
public class class_name { public void inputWatermark(Watermark watermark, int channelIndex) { // ignore the input watermark if its input channel, or all input channels are idle (i.e. overall the valve is idle). if (lastOutputStreamStatus.isActive() && channelStatuses[channelIndex].streamStatus.isActive()) { long watermarkMillis = watermark.getTimestamp(); // if the input watermark's value is less than the last received watermark for its input channel, ignore it also. if (watermarkMillis > channelStatuses[channelIndex].watermark) { channelStatuses[channelIndex].watermark = watermarkMillis; // depends on control dependency: [if], data = [none] // previously unaligned input channels are now aligned if its watermark has caught up if (!channelStatuses[channelIndex].isWatermarkAligned && watermarkMillis >= lastOutputWatermark) { channelStatuses[channelIndex].isWatermarkAligned = true; // depends on control dependency: [if], data = [none] } // now, attempt to find a new min watermark across all aligned channels findAndOutputNewMinWatermarkAcrossAlignedChannels(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private String formatParserLocation() { StringBuilder sb = new StringBuilder(); if ( paraphrases != null ) { for ( Map<DroolsParaphraseTypes, String> map : paraphrases ) { for ( Entry<DroolsParaphraseTypes, String> activeEntry : map.entrySet() ) { if ( activeEntry.getValue().length() == 0 ) { String kStr = getLocationName( activeEntry.getKey() ); if( kStr.length() > 0 ){ sb.append( String.format( PARSER_LOCATION_MESSAGE_PART, kStr ) ); } } else { sb.append( String.format( PARSER_LOCATION_MESSAGE_COMPLETE, getLocationName( activeEntry.getKey() ), activeEntry.getValue() ) ); } } } } return sb.toString(); } }
public class class_name { private String formatParserLocation() { StringBuilder sb = new StringBuilder(); if ( paraphrases != null ) { for ( Map<DroolsParaphraseTypes, String> map : paraphrases ) { for ( Entry<DroolsParaphraseTypes, String> activeEntry : map.entrySet() ) { if ( activeEntry.getValue().length() == 0 ) { String kStr = getLocationName( activeEntry.getKey() ); if( kStr.length() > 0 ){ sb.append( String.format( PARSER_LOCATION_MESSAGE_PART, kStr ) ); // depends on control dependency: [if], data = [none] } } else { sb.append( String.format( PARSER_LOCATION_MESSAGE_COMPLETE, getLocationName( activeEntry.getKey() ), activeEntry.getValue() ) ); // depends on control dependency: [if], data = [none] } } } } return sb.toString(); } }
public class class_name { @Override public void start(StartContext context) throws StartException { Set<KeytabService> services = keytabServices.getValue(); hostServiceMap = new HashMap<String, KeytabService>(services.size()); // Assume at least one per service. /* * Iterate the services and find the first one to offer default resolution, also create a hostname to KeytabService map * for the first one that claims each host. */ for (KeytabService current : services) { for (String currentHost : current.getForHosts()) { if ("*".equals(currentHost)) { if (defaultService == null) { defaultService = current; } } else if (currentHost != null) { int idx = currentHost.indexOf("/"); String hostKey = idx > -1 ? currentHost.substring(0, idx) + "/" + currentHost.substring(idx + 1).toLowerCase(Locale.ENGLISH) : currentHost.toLowerCase(Locale.ENGLISH); if (hostServiceMap.containsKey(hostKey) == false) { hostServiceMap.put(hostKey, current); } } } } /* * Iterate the services again and attempt to identify host names from the principal name and add to the map if there is * not already a mapping for that host name. */ for (KeytabService current : services) { String principal = current.getPrincipal(); int start = principal.indexOf('/'); int end = principal.indexOf('@'); String currentHost = principal.substring(start > -1 ? start + 1 : 0, end > -1 ? end : principal.length() - 1); if (hostServiceMap.containsKey(currentHost.toLowerCase(Locale.ENGLISH)) == false) { hostServiceMap.put(currentHost.toLowerCase(Locale.ENGLISH), current); } principal = principal.substring(0, end > -1 ? end : principal.length() - 1); if (principal.equals(currentHost) == false) { String principalKey = principal.substring(0, start) + "/" + currentHost.toLowerCase(Locale.ENGLISH); if (hostServiceMap.containsKey(principalKey) == false) { hostServiceMap.put(principalKey, current); } } } } }
public class class_name { @Override public void start(StartContext context) throws StartException { Set<KeytabService> services = keytabServices.getValue(); hostServiceMap = new HashMap<String, KeytabService>(services.size()); // Assume at least one per service. /* * Iterate the services and find the first one to offer default resolution, also create a hostname to KeytabService map * for the first one that claims each host. */ for (KeytabService current : services) { for (String currentHost : current.getForHosts()) { if ("*".equals(currentHost)) { if (defaultService == null) { defaultService = current; // depends on control dependency: [if], data = [none] } } else if (currentHost != null) { int idx = currentHost.indexOf("/"); String hostKey = idx > -1 ? currentHost.substring(0, idx) + "/" + currentHost.substring(idx + 1).toLowerCase(Locale.ENGLISH) : currentHost.toLowerCase(Locale.ENGLISH); if (hostServiceMap.containsKey(hostKey) == false) { hostServiceMap.put(hostKey, current); // depends on control dependency: [if], data = [none] } } } } /* * Iterate the services again and attempt to identify host names from the principal name and add to the map if there is * not already a mapping for that host name. */ for (KeytabService current : services) { String principal = current.getPrincipal(); int start = principal.indexOf('/'); int end = principal.indexOf('@'); String currentHost = principal.substring(start > -1 ? start + 1 : 0, end > -1 ? end : principal.length() - 1); if (hostServiceMap.containsKey(currentHost.toLowerCase(Locale.ENGLISH)) == false) { hostServiceMap.put(currentHost.toLowerCase(Locale.ENGLISH), current); // depends on control dependency: [if], data = [none] } principal = principal.substring(0, end > -1 ? end : principal.length() - 1); if (principal.equals(currentHost) == false) { String principalKey = principal.substring(0, start) + "/" + currentHost.toLowerCase(Locale.ENGLISH); if (hostServiceMap.containsKey(principalKey) == false) { hostServiceMap.put(principalKey, current); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { @Override public final V getEntity(final NamedParameterQueryData query) { V entity; // Entity acquired from the query checkNotNull(query, "Received a null pointer as the query"); // Tries to acquire the entity try { entity = getTemplate().queryForObject(query.getQuery(), query.getParameters(), BeanPropertyRowMapper.newInstance(getType())); } catch (final EmptyResultDataAccessException exception) { entity = null; } return entity; } }
public class class_name { @Override public final V getEntity(final NamedParameterQueryData query) { V entity; // Entity acquired from the query checkNotNull(query, "Received a null pointer as the query"); // Tries to acquire the entity try { entity = getTemplate().queryForObject(query.getQuery(), query.getParameters(), BeanPropertyRowMapper.newInstance(getType())); // depends on control dependency: [try], data = [none] } catch (final EmptyResultDataAccessException exception) { entity = null; } // depends on control dependency: [catch], data = [none] return entity; } }
public class class_name { public void writePocketsToPMesh(String outPutFileName) { try { for (int i = 0; i < pockets.size(); i++) {// go through every // pocket BufferedWriter writer = new BufferedWriter(new FileWriter(outPutFileName + "-" + i + ".pmesh")); List<Point3d> pocket = pockets.get(i); writer.write(pocket.size() + "\n"); for (int j = 0; j < pocket.size(); j++) {// go through every // grid point of the // actual pocket Point3d actualGridPoint = (Point3d) pocket.get(j); Point3d coords = gridGenerator.getCoordinatesFromGridPoint(actualGridPoint); writer.write(coords.x + "\t" + coords.y + "\t" + coords.z + "\n"); } writer.close(); } } catch (IOException e) { logger.debug(e); } } }
public class class_name { public void writePocketsToPMesh(String outPutFileName) { try { for (int i = 0; i < pockets.size(); i++) {// go through every // pocket BufferedWriter writer = new BufferedWriter(new FileWriter(outPutFileName + "-" + i + ".pmesh")); List<Point3d> pocket = pockets.get(i); writer.write(pocket.size() + "\n"); // depends on control dependency: [for], data = [none] for (int j = 0; j < pocket.size(); j++) {// go through every // grid point of the // actual pocket Point3d actualGridPoint = (Point3d) pocket.get(j); Point3d coords = gridGenerator.getCoordinatesFromGridPoint(actualGridPoint); writer.write(coords.x + "\t" + coords.y + "\t" + coords.z + "\n"); // depends on control dependency: [for], data = [none] } writer.close(); // depends on control dependency: [for], data = [none] } } catch (IOException e) { logger.debug(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<Record> handle(Record record) { boolean isPrinting = false; if(record.force()){ //--Case: Force Printing isPrinting = true; } else { //--Case: Filter switch (this.defaultState){ case HIDE_ALL: //--Default False for(Object tag : record.channels()){ if(this.deltaPool.contains(tag)){ isPrinting = true; break; } } break; case SHOW_ALL: //--Default True boolean somethingSeen = false; for(Object tag : record.channels()){ if(this.deltaPool.contains(tag)){ somethingSeen = true; break; } } isPrinting = !somethingSeen; break; default: throw new IllegalStateException("Unknown default state setting: " + this.defaultState); } } //--Return if(isPrinting){ ArrayList<Record> retVal = new ArrayList<Record>(); retVal.add(record); return retVal; } else { return EMPTY; } } }
public class class_name { public List<Record> handle(Record record) { boolean isPrinting = false; if(record.force()){ //--Case: Force Printing isPrinting = true; // depends on control dependency: [if], data = [none] } else { //--Case: Filter switch (this.defaultState){ case HIDE_ALL: //--Default False for(Object tag : record.channels()){ if(this.deltaPool.contains(tag)){ isPrinting = true; // depends on control dependency: [if], data = [none] break; } } break; case SHOW_ALL: //--Default True boolean somethingSeen = false; for(Object tag : record.channels()){ if(this.deltaPool.contains(tag)){ somethingSeen = true; break; } // depends on control dependency: [if], data = [none] } isPrinting = !somethingSeen; break; default: throw new IllegalStateException("Unknown default state setting: " + this.defaultState); } } //--Return if(isPrinting){ ArrayList<Record> retVal = new ArrayList<Record>(); retVal.add(record); // depends on control dependency: [if], data = [none] return retVal; // depends on control dependency: [if], data = [none] } else { return EMPTY; // depends on control dependency: [if], data = [none] } } }
public class class_name { private List<Method> findSubscriberMethods(Object subscriber) throws InvalidSubscriberException { List<Method> subscriberMethods = new ArrayList<Method>(); Set<Method> allMethods = new HashSet<Method>(); Method[] methods = subscriber.getClass().getMethods(); allMethods.addAll(Arrays.asList(methods)); // This enables declaring even private methods in a consumer. We will try to enable access, failure of which // will remove this method from the methods list. Method[] allDeclaredMethods = subscriber.getClass().getDeclaredMethods(); allMethods.addAll(Arrays.asList(allDeclaredMethods)); for (Method method : allMethods) { if (method.isAnnotationPresent(Subscribe.class)) { try { method.setAccessible(true); subscriberMethods.add(method); } catch (SecurityException e) { LOGGER.error("A subscriber method: " + method.toGenericString() + " is not a public method and the security settings does not allow accessing non-public" + " methods via reflection. This subscriber method will not be registered.", e); } } } Map<Method, String> errors = SubscriberValidator.validate(subscriber, subscriberMethods); if (!errors.isEmpty()) { throw new InvalidSubscriberException(subscriber.getClass(), errors); } return subscriberMethods; } }
public class class_name { private List<Method> findSubscriberMethods(Object subscriber) throws InvalidSubscriberException { List<Method> subscriberMethods = new ArrayList<Method>(); Set<Method> allMethods = new HashSet<Method>(); Method[] methods = subscriber.getClass().getMethods(); allMethods.addAll(Arrays.asList(methods)); // This enables declaring even private methods in a consumer. We will try to enable access, failure of which // will remove this method from the methods list. Method[] allDeclaredMethods = subscriber.getClass().getDeclaredMethods(); allMethods.addAll(Arrays.asList(allDeclaredMethods)); for (Method method : allMethods) { if (method.isAnnotationPresent(Subscribe.class)) { try { method.setAccessible(true); // depends on control dependency: [try], data = [none] subscriberMethods.add(method); // depends on control dependency: [try], data = [none] } catch (SecurityException e) { LOGGER.error("A subscriber method: " + method.toGenericString() + " is not a public method and the security settings does not allow accessing non-public" + " methods via reflection. This subscriber method will not be registered.", e); } // depends on control dependency: [catch], data = [none] } } Map<Method, String> errors = SubscriberValidator.validate(subscriber, subscriberMethods); if (!errors.isEmpty()) { throw new InvalidSubscriberException(subscriber.getClass(), errors); } return subscriberMethods; } }
public class class_name { public static File toFile(final URL aURL) { Objects.requireNonNull(aURL, LOGGER.getI18n(MessageCodes.UTIL_031)); if (!FILE_PROTOCOL.equals(aURL.getProtocol())) { throw new UnsupportedOperationException(LOGGER.getI18n(MessageCodes.UTIL_030)); } String string = aURL.toExternalForm(); // An invalid URL created using file.toURL() or file.toURI().toURL() on a specific version of Java 5 on Mac if (string.contains(PLUS)) { string = string.replace(PLUS, "%2B"); } try { string = URLDecoder.decode(string, StandardCharsets.UTF_8.name()); } catch (final java.io.UnsupportedEncodingException details) { throw new UnsupportedEncodingException(details, MessageCodes.UTIL_029); } final String path3; if (OS.toUpperCase(Locale.US).contains("WINDOWS") && string.startsWith(STANDARD_PREFIX)) { path3 = string.substring(STANDARD_PREFIX.length() - 2); } else if (string.startsWith(STANDARD_PREFIX)) { path3 = string.substring(STANDARD_PREFIX.length()); } else if (string.startsWith(SIMPLE_PREFIX)) { path3 = string.substring(SIMPLE_PREFIX.length() - 1); } else { final String auth = aURL.getAuthority(); final String path2 = aURL.getPath().replace("%20", " "); if (auth != null && !"".equals(auth)) { path3 = "//" + auth + path2; } else { path3 = path2; } } return new File(path3); } }
public class class_name { public static File toFile(final URL aURL) { Objects.requireNonNull(aURL, LOGGER.getI18n(MessageCodes.UTIL_031)); if (!FILE_PROTOCOL.equals(aURL.getProtocol())) { throw new UnsupportedOperationException(LOGGER.getI18n(MessageCodes.UTIL_030)); } String string = aURL.toExternalForm(); // An invalid URL created using file.toURL() or file.toURI().toURL() on a specific version of Java 5 on Mac if (string.contains(PLUS)) { string = string.replace(PLUS, "%2B"); // depends on control dependency: [if], data = [none] } try { string = URLDecoder.decode(string, StandardCharsets.UTF_8.name()); // depends on control dependency: [try], data = [none] } catch (final java.io.UnsupportedEncodingException details) { throw new UnsupportedEncodingException(details, MessageCodes.UTIL_029); } // depends on control dependency: [catch], data = [none] final String path3; if (OS.toUpperCase(Locale.US).contains("WINDOWS") && string.startsWith(STANDARD_PREFIX)) { path3 = string.substring(STANDARD_PREFIX.length() - 2); // depends on control dependency: [if], data = [none] } else if (string.startsWith(STANDARD_PREFIX)) { path3 = string.substring(STANDARD_PREFIX.length()); // depends on control dependency: [if], data = [none] } else if (string.startsWith(SIMPLE_PREFIX)) { path3 = string.substring(SIMPLE_PREFIX.length() - 1); // depends on control dependency: [if], data = [none] } else { final String auth = aURL.getAuthority(); final String path2 = aURL.getPath().replace("%20", " "); if (auth != null && !"".equals(auth)) { path3 = "//" + auth + path2; } else { path3 = path2; // depends on control dependency: [if], data = [none] } } return new File(path3); } }
public class class_name { public EClass getBandImageData() { if (bandImageDataEClass == null) { bandImageDataEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(400); } return bandImageDataEClass; } }
public class class_name { public EClass getBandImageData() { if (bandImageDataEClass == null) { bandImageDataEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(400); // depends on control dependency: [if], data = [none] } return bandImageDataEClass; } }
public class class_name { public void add(int index, Object element) { DListEntry entry = prepareEntry(element); elements.add(index, entry); // if we are in a transaction: acquire locks ! TransactionImpl tx = getTransaction(); if (checkForOpenTransaction(tx)) { RuntimeObject rt = new RuntimeObject(this, tx); List regList = tx.getRegistrationList(); tx.lockAndRegister(rt, Transaction.WRITE, false, regList); rt = new RuntimeObject(element, tx); tx.lockAndRegister(rt, Transaction.READ, regList); rt = new RuntimeObject(entry, tx, true); tx.lockAndRegister(rt, Transaction.WRITE, false, regList); } // changing the position markers of entries: int offset = 0; try { offset = ((DListEntry) elements.get(index - 1)).getPosition(); } catch (Exception ignored) { } for (int i = offset; i < elements.size(); i++) { entry = (DListEntry) elements.get(i); entry.setPosition(i); } } }
public class class_name { public void add(int index, Object element) { DListEntry entry = prepareEntry(element); elements.add(index, entry); // if we are in a transaction: acquire locks ! TransactionImpl tx = getTransaction(); if (checkForOpenTransaction(tx)) { RuntimeObject rt = new RuntimeObject(this, tx); List regList = tx.getRegistrationList(); tx.lockAndRegister(rt, Transaction.WRITE, false, regList); // depends on control dependency: [if], data = [none] rt = new RuntimeObject(element, tx); // depends on control dependency: [if], data = [none] tx.lockAndRegister(rt, Transaction.READ, regList); // depends on control dependency: [if], data = [none] rt = new RuntimeObject(entry, tx, true); // depends on control dependency: [if], data = [none] tx.lockAndRegister(rt, Transaction.WRITE, false, regList); // depends on control dependency: [if], data = [none] } // changing the position markers of entries: int offset = 0; try { offset = ((DListEntry) elements.get(index - 1)).getPosition(); // depends on control dependency: [try], data = [none] } catch (Exception ignored) { } // depends on control dependency: [catch], data = [none] for (int i = offset; i < elements.size(); i++) { entry = (DListEntry) elements.get(i); // depends on control dependency: [for], data = [i] entry.setPosition(i); // depends on control dependency: [for], data = [i] } } }
public class class_name { @EventHandler public void onSelectFilter(SelectFilterEvent selectFilterEvent){ for (FacetWidget facetWidget : filterList) { if(facetWidget.getFacetField().equals(selectFilterEvent.getFilterName())){ for (FacetWidgetItem facetWidgetItem : facetWidget.getFacetWidgetItems()) { if(facetWidgetItem.getValue().equals(selectFilterEvent.getFilterValue())){ facetWidget.selectItems(Arrays.asList(facetWidgetItem)); } } } } } }
public class class_name { @EventHandler public void onSelectFilter(SelectFilterEvent selectFilterEvent){ for (FacetWidget facetWidget : filterList) { if(facetWidget.getFacetField().equals(selectFilterEvent.getFilterName())){ for (FacetWidgetItem facetWidgetItem : facetWidget.getFacetWidgetItems()) { if(facetWidgetItem.getValue().equals(selectFilterEvent.getFilterValue())){ facetWidget.selectItems(Arrays.asList(facetWidgetItem)); // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { SymbolToken find(String text) { for (int i = 0; i < myImports.length; i++) { SymbolTable importedTable = myImports[i]; SymbolToken tok = importedTable.find(text); if (tok != null) { int sid = tok.getSid() + myBaseSids[i]; text = tok.getText(); // Use interned instance assert text != null; return new SymbolTokenImpl(text, sid); } } return null; } }
public class class_name { SymbolToken find(String text) { for (int i = 0; i < myImports.length; i++) { SymbolTable importedTable = myImports[i]; SymbolToken tok = importedTable.find(text); if (tok != null) { int sid = tok.getSid() + myBaseSids[i]; text = tok.getText(); // Use interned instance // depends on control dependency: [if], data = [none] assert text != null; return new SymbolTokenImpl(text, sid); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { private boolean hasPublicEmptyConstructor(DeclaredType type) { Element element = type.asElement(); List<? extends Element> containing = element.getEnclosedElements(); for (Element e : containing) { if (e.getKind() == ElementKind.CONSTRUCTOR) { ExecutableElement c = (ExecutableElement) e; if ((c.getParameters() == null || c.getParameters().isEmpty()) && c.getModifiers() .contains(javax.lang.model.element.Modifier.PUBLIC)) { return true; } } } return false; } }
public class class_name { private boolean hasPublicEmptyConstructor(DeclaredType type) { Element element = type.asElement(); List<? extends Element> containing = element.getEnclosedElements(); for (Element e : containing) { if (e.getKind() == ElementKind.CONSTRUCTOR) { ExecutableElement c = (ExecutableElement) e; if ((c.getParameters() == null || c.getParameters().isEmpty()) && c.getModifiers() .contains(javax.lang.model.element.Modifier.PUBLIC)) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { private JPanel getJPanel() { if (jPanel == null) { // TODO add a cancel button? //java.awt.GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); java.awt.GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); java.awt.GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); gridBagConstraints5.gridx = 0; gridBagConstraints5.gridy = 0; gridBagConstraints5.insets = new java.awt.Insets(0,0,0,0); gridBagConstraints5.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints5.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints5.weightx = 1.0D; gridBagConstraints5.weighty = 1.0D; gridBagConstraints5.ipady = 2; gridBagConstraints5.gridwidth = 2; gridBagConstraints6.gridx = 1; gridBagConstraints6.gridy = 1; gridBagConstraints6.insets = new java.awt.Insets(2,2,2,2); gridBagConstraints6.anchor = java.awt.GridBagConstraints.SOUTHEAST; //gridBagConstraints7.gridx = 1; //gridBagConstraints7.gridy = 0; //gridBagConstraints7.insets = new java.awt.Insets(2,2,2,2); //gridBagConstraints7.anchor = java.awt.GridBagConstraints.SOUTHWEST; jPanel.add(getConnPanel(), gridBagConstraints5); //jPanel.add(getBtnCancel(), gridBagConstraints7); jPanel.add(getBtnOK(), gridBagConstraints6); } return jPanel; } }
public class class_name { private JPanel getJPanel() { if (jPanel == null) { // TODO add a cancel button? //java.awt.GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); java.awt.GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); java.awt.GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); jPanel = new JPanel(); // depends on control dependency: [if], data = [none] jPanel.setLayout(new GridBagLayout()); // depends on control dependency: [if], data = [none] gridBagConstraints5.gridx = 0; // depends on control dependency: [if], data = [none] gridBagConstraints5.gridy = 0; // depends on control dependency: [if], data = [none] gridBagConstraints5.insets = new java.awt.Insets(0,0,0,0); // depends on control dependency: [if], data = [none] gridBagConstraints5.fill = java.awt.GridBagConstraints.BOTH; // depends on control dependency: [if], data = [none] gridBagConstraints5.anchor = java.awt.GridBagConstraints.NORTHWEST; // depends on control dependency: [if], data = [none] gridBagConstraints5.weightx = 1.0D; // depends on control dependency: [if], data = [none] gridBagConstraints5.weighty = 1.0D; // depends on control dependency: [if], data = [none] gridBagConstraints5.ipady = 2; // depends on control dependency: [if], data = [none] gridBagConstraints5.gridwidth = 2; // depends on control dependency: [if], data = [none] gridBagConstraints6.gridx = 1; // depends on control dependency: [if], data = [none] gridBagConstraints6.gridy = 1; // depends on control dependency: [if], data = [none] gridBagConstraints6.insets = new java.awt.Insets(2,2,2,2); // depends on control dependency: [if], data = [none] gridBagConstraints6.anchor = java.awt.GridBagConstraints.SOUTHEAST; // depends on control dependency: [if], data = [none] //gridBagConstraints7.gridx = 1; //gridBagConstraints7.gridy = 0; //gridBagConstraints7.insets = new java.awt.Insets(2,2,2,2); //gridBagConstraints7.anchor = java.awt.GridBagConstraints.SOUTHWEST; jPanel.add(getConnPanel(), gridBagConstraints5); // depends on control dependency: [if], data = [none] //jPanel.add(getBtnCancel(), gridBagConstraints7); jPanel.add(getBtnOK(), gridBagConstraints6); // depends on control dependency: [if], data = [none] } return jPanel; } }
public class class_name { private void insertCheckFringeBalance( InsertStack stack, GBSNode endp, int endIndex, int maxBal) { GBSNode fpoint = null; /* This points to the first half leaf we */ /* find that has a right child but no */ /* left child. If any rebalancing is */ /* to be done to a fringe, this will be */ /* the fringe balance point. */ int fDepth = 0; /* Fringe balance depth */ int fpidx = 0; /* Index into NodeStack where fpoint was */ /* last saved */ /* Check to see if we have filled out a final node, which may have */ /* filled out a fringe to the re-balance point. The absence of a */ /* left child means it is part of a fringe. If this is the case we */ /* walk backward through the tree looking for the top of the fringe. */ if ( (endp.isFull()) && (endp.leftChild() == null) ) { fDepth = 1; /* Last node counts as one */ for (int j = endIndex; j > 0; j--) { GBSNode q = stack.node(j); if (q.leftChild() != null)/* Found the top of the fringe */ break; else /* Not yet the top of the fringe */ { fDepth++; /* Bump fringe depth */ fpoint = q; /* Remember possible fringe balance point*/ fpidx = j; /* and its index in the stack */ } } if (fDepth >= maxBal) { _xno++; GBSInsertFringe.singleInstance().balance( kFactor(), stack, fpoint, fpidx, maxBal); } } } }
public class class_name { private void insertCheckFringeBalance( InsertStack stack, GBSNode endp, int endIndex, int maxBal) { GBSNode fpoint = null; /* This points to the first half leaf we */ /* find that has a right child but no */ /* left child. If any rebalancing is */ /* to be done to a fringe, this will be */ /* the fringe balance point. */ int fDepth = 0; /* Fringe balance depth */ int fpidx = 0; /* Index into NodeStack where fpoint was */ /* last saved */ /* Check to see if we have filled out a final node, which may have */ /* filled out a fringe to the re-balance point. The absence of a */ /* left child means it is part of a fringe. If this is the case we */ /* walk backward through the tree looking for the top of the fringe. */ if ( (endp.isFull()) && (endp.leftChild() == null) ) { fDepth = 1; /* Last node counts as one */ // depends on control dependency: [if], data = [none] for (int j = endIndex; j > 0; j--) { GBSNode q = stack.node(j); if (q.leftChild() != null)/* Found the top of the fringe */ break; else /* Not yet the top of the fringe */ { fDepth++; /* Bump fringe depth */ // depends on control dependency: [if], data = [none] fpoint = q; /* Remember possible fringe balance point*/ // depends on control dependency: [if], data = [none] fpidx = j; /* and its index in the stack */ // depends on control dependency: [if], data = [none] } } if (fDepth >= maxBal) { _xno++; // depends on control dependency: [if], data = [none] GBSInsertFringe.singleInstance().balance( kFactor(), stack, fpoint, fpidx, maxBal); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(GetRoomSkillParameterRequest getRoomSkillParameterRequest, ProtocolMarshaller protocolMarshaller) { if (getRoomSkillParameterRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getRoomSkillParameterRequest.getRoomArn(), ROOMARN_BINDING); protocolMarshaller.marshall(getRoomSkillParameterRequest.getSkillId(), SKILLID_BINDING); protocolMarshaller.marshall(getRoomSkillParameterRequest.getParameterKey(), PARAMETERKEY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetRoomSkillParameterRequest getRoomSkillParameterRequest, ProtocolMarshaller protocolMarshaller) { if (getRoomSkillParameterRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getRoomSkillParameterRequest.getRoomArn(), ROOMARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getRoomSkillParameterRequest.getSkillId(), SKILLID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getRoomSkillParameterRequest.getParameterKey(), PARAMETERKEY_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 { @Override public Object load(String batchId) { Object loadedArtifact; loadedArtifact = getArtifactById(batchId); if (loadedArtifact != null) { if (logger.isLoggable(Level.FINEST)) { logger.finest("load: batchId: " + batchId + ", artifact: " + loadedArtifact + ", artifact class: " + loadedArtifact.getClass().getCanonicalName()); } } return loadedArtifact; } }
public class class_name { @Override public Object load(String batchId) { Object loadedArtifact; loadedArtifact = getArtifactById(batchId); if (loadedArtifact != null) { if (logger.isLoggable(Level.FINEST)) { logger.finest("load: batchId: " + batchId + ", artifact: " + loadedArtifact + ", artifact class: " + loadedArtifact.getClass().getCanonicalName()); // depends on control dependency: [if], data = [none] } } return loadedArtifact; } }
public class class_name { public static String meterToKind(Registry registry, Meter meter) { String kind; if (meter instanceof Timer) { kind = "Timer"; } else if (meter instanceof Counter) { kind = "Counter"; } else if (meter instanceof Gauge) { kind = "Gauge"; } else if (meter instanceof DistributionSummary) { kind = "DistributionSummary"; } else { kind = meter.getClass().getSimpleName(); } return kind; } }
public class class_name { public static String meterToKind(Registry registry, Meter meter) { String kind; if (meter instanceof Timer) { kind = "Timer"; // depends on control dependency: [if], data = [none] } else if (meter instanceof Counter) { kind = "Counter"; // depends on control dependency: [if], data = [none] } else if (meter instanceof Gauge) { kind = "Gauge"; // depends on control dependency: [if], data = [none] } else if (meter instanceof DistributionSummary) { kind = "DistributionSummary"; // depends on control dependency: [if], data = [none] } else { kind = meter.getClass().getSimpleName(); // depends on control dependency: [if], data = [none] } return kind; } }
public class class_name { public int removeJob(JobKey key) throws IOException { byte[] jobRow = jobKeyConv.toBytes(key); Table historyTable = hbaseConnection.getTable(TableName.valueOf(Constants.HISTORY_TABLE)); historyTable.delete(new Delete(jobRow)); historyTable.close(); int deleteCount = 1; // delete all task rows Scan taskScan = getTaskScan(key); // only need the row keys back to delete (all should have taskid) taskScan.addColumn(Constants.INFO_FAM_BYTES, JobHistoryKeys.KEYS_TO_BYTES.get(JobHistoryKeys.TASKID)); // no reason to cache rows we're deleting taskScan.setCacheBlocks(false); List<Delete> taskDeletes = new ArrayList<Delete>(); Table taskTable = hbaseConnection .getTable(TableName.valueOf(Constants.HISTORY_TASK_TABLE)); ResultScanner scanner = taskTable.getScanner(taskScan); try { for (Result r : scanner) { if (r != null && !r.isEmpty()) { byte[] rowKey = r.getRow(); TaskKey taskKey = taskKeyConv.fromBytes(rowKey); if (!key.equals(taskKey)) { LOG.warn("Found task not in the current job " + Bytes.toStringBinary(rowKey)); break; } taskDeletes.add(new Delete(r.getRow())); } } // Hang on the count because delete will modify our list. deleteCount += taskDeletes.size(); if (taskDeletes.size() > 0) { LOG.info("Deleting " + taskDeletes.size() + " tasks for job " + key); taskTable.delete(taskDeletes); } } finally { scanner.close(); taskTable.close(); } return deleteCount; } }
public class class_name { public int removeJob(JobKey key) throws IOException { byte[] jobRow = jobKeyConv.toBytes(key); Table historyTable = hbaseConnection.getTable(TableName.valueOf(Constants.HISTORY_TABLE)); historyTable.delete(new Delete(jobRow)); historyTable.close(); int deleteCount = 1; // delete all task rows Scan taskScan = getTaskScan(key); // only need the row keys back to delete (all should have taskid) taskScan.addColumn(Constants.INFO_FAM_BYTES, JobHistoryKeys.KEYS_TO_BYTES.get(JobHistoryKeys.TASKID)); // no reason to cache rows we're deleting taskScan.setCacheBlocks(false); List<Delete> taskDeletes = new ArrayList<Delete>(); Table taskTable = hbaseConnection .getTable(TableName.valueOf(Constants.HISTORY_TASK_TABLE)); ResultScanner scanner = taskTable.getScanner(taskScan); try { for (Result r : scanner) { if (r != null && !r.isEmpty()) { byte[] rowKey = r.getRow(); TaskKey taskKey = taskKeyConv.fromBytes(rowKey); if (!key.equals(taskKey)) { LOG.warn("Found task not in the current job " + Bytes.toStringBinary(rowKey)); // depends on control dependency: [if], data = [none] break; } taskDeletes.add(new Delete(r.getRow())); // depends on control dependency: [if], data = [(r] } } // Hang on the count because delete will modify our list. deleteCount += taskDeletes.size(); if (taskDeletes.size() > 0) { LOG.info("Deleting " + taskDeletes.size() + " tasks for job " + key); // depends on control dependency: [if], data = [none] taskTable.delete(taskDeletes); // depends on control dependency: [if], data = [none] } } finally { scanner.close(); taskTable.close(); } return deleteCount; } }
public class class_name { private static URL getConfigUrl() throws ConfigurationException { String spec = System.getProperty(CONFIG_URL_PROPERTY_NAME); if (spec == null) { spec = DEFAULT_CONFIG_URL; } URL configUrl = null; try { configUrl = new URL(spec); configUrl.openStream().close(); // catches well-formed but bogus URLs } catch (Exception e) { try { File f = new File(spec); if (f.exists()) { configUrl = new URL("file:///" + f.getCanonicalPath()); } } catch( Exception ex) { } } if (configUrl == null) { ClassLoader loader = ServerParams.class.getClassLoader(); configUrl = loader.getResource(spec); if (configUrl == null) { throw new ConfigurationException("Can't find file/resource: \"" + spec + "\"."); } } return configUrl; } }
public class class_name { private static URL getConfigUrl() throws ConfigurationException { String spec = System.getProperty(CONFIG_URL_PROPERTY_NAME); if (spec == null) { spec = DEFAULT_CONFIG_URL; } URL configUrl = null; try { configUrl = new URL(spec); configUrl.openStream().close(); // catches well-formed but bogus URLs } catch (Exception e) { try { File f = new File(spec); if (f.exists()) { configUrl = new URL("file:///" + f.getCanonicalPath()); } } catch( Exception ex) { } // depends on control dependency: [catch], data = [none] } if (configUrl == null) { ClassLoader loader = ServerParams.class.getClassLoader(); configUrl = loader.getResource(spec); if (configUrl == null) { throw new ConfigurationException("Can't find file/resource: \"" + spec + "\"."); } } return configUrl; } }
public class class_name { public AwsEc2InstanceDetails withIpV6Addresses(String... ipV6Addresses) { if (this.ipV6Addresses == null) { setIpV6Addresses(new java.util.ArrayList<String>(ipV6Addresses.length)); } for (String ele : ipV6Addresses) { this.ipV6Addresses.add(ele); } return this; } }
public class class_name { public AwsEc2InstanceDetails withIpV6Addresses(String... ipV6Addresses) { if (this.ipV6Addresses == null) { setIpV6Addresses(new java.util.ArrayList<String>(ipV6Addresses.length)); // depends on control dependency: [if], data = [none] } for (String ele : ipV6Addresses) { this.ipV6Addresses.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private String escapeSql(final Object obj) { if (obj == null) { return ""; } else { String val = obj.toString(); return val.replace("'", "''"); } } }
public class class_name { private String escapeSql(final Object obj) { if (obj == null) { return ""; // depends on control dependency: [if], data = [none] } else { String val = obj.toString(); return val.replace("'", "''"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addMasterListeners() { super.addMasterListeners(); this.getField(UserInfo.USER_NAME).addListener(new CheckNonNumericListener(null)); this.addListener(new ReadOnlyRecordHandler(this.getField(UserInfo.READ_ONLY_RECORD), true)); this.addListener(new FileListener(null) { /** * Make sure the user group ID is non-null (set it to the anon group id) */ public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Read a valid record switch (iChangeType) { case DBConstants.ADD_TYPE: case DBConstants.UPDATE_TYPE: if (this.getOwner().getField(UserInfo.USER_GROUP_ID).isNull()) if (this.getOwner().getRecordOwner() != null) { Record recUserControl = (Record)this.getOwner().getRecordOwner().getRecord(UserControl.USER_CONTROL_FILE); if (recUserControl == null) { recUserControl = new UserControl(this.getOwner().getRecordOwner()); this.getOwner().addListener(new FreeOnFreeHandler(recUserControl)); } this.getOwner().getField(UserInfo.USER_GROUP_ID).moveFieldToThis(recUserControl.getField(UserControl.ANON_USER_GROUP_ID)); } break; } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record } }); } }
public class class_name { public void addMasterListeners() { super.addMasterListeners(); this.getField(UserInfo.USER_NAME).addListener(new CheckNonNumericListener(null)); this.addListener(new ReadOnlyRecordHandler(this.getField(UserInfo.READ_ONLY_RECORD), true)); this.addListener(new FileListener(null) { /** * Make sure the user group ID is non-null (set it to the anon group id) */ public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Read a valid record switch (iChangeType) { case DBConstants.ADD_TYPE: case DBConstants.UPDATE_TYPE: if (this.getOwner().getField(UserInfo.USER_GROUP_ID).isNull()) if (this.getOwner().getRecordOwner() != null) { Record recUserControl = (Record)this.getOwner().getRecordOwner().getRecord(UserControl.USER_CONTROL_FILE); if (recUserControl == null) { recUserControl = new UserControl(this.getOwner().getRecordOwner()); // depends on control dependency: [if], data = [none] this.getOwner().addListener(new FreeOnFreeHandler(recUserControl)); // depends on control dependency: [if], data = [(recUserControl] } this.getOwner().getField(UserInfo.USER_GROUP_ID).moveFieldToThis(recUserControl.getField(UserControl.ANON_USER_GROUP_ID)); // depends on control dependency: [if], data = [none] } break; } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record } }); } }
public class class_name { public XYDataItem getDataItem(int index) { // int id = start + index * stepsize; // if (id >= variable.getVariable().getMatrixCount()) { // return new XYDataItem(id, 0.0); // } // // Matrix matrix = variable.getVariable().getMatrix(id); // double value = 0.0; // try { // value = matrix.getAsDouble(number % matrix.getRowCount(), number // / matrix.getRowCount()); // } catch (MatrixException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // // XYDataItem xyDataItem = values.get(id); // if (xyDataItem == null) { // xyDataItem = new XYDataItem(id, value); // values.put(id, xyDataItem); // } else { // xyDataItem.setY(value); // } // // return xyDataItem; double row = index; try { row = Double.parseDouble(matrix.getMatrix().getRowLabel(index)); } catch (Exception e) { } return new XYDataItem(row, matrix.getMatrix().getAsDouble(index, seriesId)); } }
public class class_name { public XYDataItem getDataItem(int index) { // int id = start + index * stepsize; // if (id >= variable.getVariable().getMatrixCount()) { // return new XYDataItem(id, 0.0); // } // // Matrix matrix = variable.getVariable().getMatrix(id); // double value = 0.0; // try { // value = matrix.getAsDouble(number % matrix.getRowCount(), number // / matrix.getRowCount()); // } catch (MatrixException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // // XYDataItem xyDataItem = values.get(id); // if (xyDataItem == null) { // xyDataItem = new XYDataItem(id, value); // values.put(id, xyDataItem); // } else { // xyDataItem.setY(value); // } // // return xyDataItem; double row = index; try { row = Double.parseDouble(matrix.getMatrix().getRowLabel(index)); // depends on control dependency: [try], data = [none] } catch (Exception e) { } // depends on control dependency: [catch], data = [none] return new XYDataItem(row, matrix.getMatrix().getAsDouble(index, seriesId)); } }
public class class_name { public void marshall(ResourceTargetDefinition resourceTargetDefinition, ProtocolMarshaller protocolMarshaller) { if (resourceTargetDefinition == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resourceTargetDefinition.getAttribute(), ATTRIBUTE_BINDING); protocolMarshaller.marshall(resourceTargetDefinition.getName(), NAME_BINDING); protocolMarshaller.marshall(resourceTargetDefinition.getRequiresRecreation(), REQUIRESRECREATION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ResourceTargetDefinition resourceTargetDefinition, ProtocolMarshaller protocolMarshaller) { if (resourceTargetDefinition == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resourceTargetDefinition.getAttribute(), ATTRIBUTE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resourceTargetDefinition.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resourceTargetDefinition.getRequiresRecreation(), REQUIRESRECREATION_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 String[] getArray(final String key) { final String value = getProperty(key); if (value != null) { final String[] strings = value.split(",[\\s]*|[\\s]*$"); return strings; } return null; } }
public class class_name { public String[] getArray(final String key) { final String value = getProperty(key); if (value != null) { final String[] strings = value.split(",[\\s]*|[\\s]*$"); return strings; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { static ResourceBundle getMessageBundle(Language lang) { try { ResourceBundle bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, lang.getLocaleWithCountryAndVariant()); if (!isValidBundleFor(lang, bundle)) { bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, lang.getLocale()); if (!isValidBundleFor(lang, bundle)) { // happens if 'xx' is requested but only a MessagesBundle_xx_YY.properties exists: Language defaultVariant = lang.getDefaultLanguageVariant(); if (defaultVariant != null && defaultVariant.getCountries().length > 0) { Locale locale = new Locale(defaultVariant.getShortCode(), defaultVariant.getCountries()[0]); bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, locale); } } } ResourceBundle fallbackBundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, Locale.ENGLISH); return new ResourceBundleWithFallback(bundle, fallbackBundle); } catch (MissingResourceException e) { return ResourceBundle.getBundle(MESSAGE_BUNDLE, Locale.ENGLISH); } } }
public class class_name { static ResourceBundle getMessageBundle(Language lang) { try { ResourceBundle bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, lang.getLocaleWithCountryAndVariant()); if (!isValidBundleFor(lang, bundle)) { bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, lang.getLocale()); // depends on control dependency: [if], data = [none] if (!isValidBundleFor(lang, bundle)) { // happens if 'xx' is requested but only a MessagesBundle_xx_YY.properties exists: Language defaultVariant = lang.getDefaultLanguageVariant(); if (defaultVariant != null && defaultVariant.getCountries().length > 0) { Locale locale = new Locale(defaultVariant.getShortCode(), defaultVariant.getCountries()[0]); bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, locale); // depends on control dependency: [if], data = [none] } } } ResourceBundle fallbackBundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, Locale.ENGLISH); return new ResourceBundleWithFallback(bundle, fallbackBundle); // depends on control dependency: [try], data = [none] } catch (MissingResourceException e) { return ResourceBundle.getBundle(MESSAGE_BUNDLE, Locale.ENGLISH); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void mkRefreshConfThread(final NimbusData nimbusData) { nimbusData.getScheduExec().scheduleAtFixedRate(new RunnableCallback() { @Override public void run() { LOG.debug("checking changes in storm.yaml..."); Map newConf = Utils.readStormConfig(); if (Utils.isConfigChanged(nimbusData.getConf(), newConf)) { LOG.warn("detected changes in storm.yaml, updating..."); synchronized (nimbusData.getConf()) { nimbusData.getConf().clear(); nimbusData.getConf().putAll(newConf); } RefreshableComponents.refresh(newConf); } else { LOG.debug("no changes detected, stay put."); } } @Override public Object getResult() { return 15; } }, 15, 15, TimeUnit.SECONDS); LOG.info("Successfully init configuration refresh thread"); } }
public class class_name { private void mkRefreshConfThread(final NimbusData nimbusData) { nimbusData.getScheduExec().scheduleAtFixedRate(new RunnableCallback() { @Override public void run() { LOG.debug("checking changes in storm.yaml..."); Map newConf = Utils.readStormConfig(); if (Utils.isConfigChanged(nimbusData.getConf(), newConf)) { LOG.warn("detected changes in storm.yaml, updating..."); // depends on control dependency: [if], data = [none] synchronized (nimbusData.getConf()) { // depends on control dependency: [if], data = [none] nimbusData.getConf().clear(); nimbusData.getConf().putAll(newConf); } RefreshableComponents.refresh(newConf); // depends on control dependency: [if], data = [none] } else { LOG.debug("no changes detected, stay put."); // depends on control dependency: [if], data = [none] } } @Override public Object getResult() { return 15; } }, 15, 15, TimeUnit.SECONDS); LOG.info("Successfully init configuration refresh thread"); } }
public class class_name { public void addTransportListener(JingleTransportListener li) { for (ContentNegotiator contentNegotiator : contentNegotiators) { if (contentNegotiator.getTransportNegotiator() != null) { contentNegotiator.getTransportNegotiator().addListener(li); } } } }
public class class_name { public void addTransportListener(JingleTransportListener li) { for (ContentNegotiator contentNegotiator : contentNegotiators) { if (contentNegotiator.getTransportNegotiator() != null) { contentNegotiator.getTransportNegotiator().addListener(li); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static String getUriWithOutputDir(DocumentURI key, String outputDir){ String uri = key.getUri(); if (outputDir != null && !outputDir.isEmpty()) { uri = outputDir.endsWith("/") || uri.startsWith("/") ? outputDir + uri : outputDir + '/' + uri; key.setUri(uri); key.validate(); } return uri; } }
public class class_name { public static String getUriWithOutputDir(DocumentURI key, String outputDir){ String uri = key.getUri(); if (outputDir != null && !outputDir.isEmpty()) { uri = outputDir.endsWith("/") || uri.startsWith("/") ? outputDir + uri : outputDir + '/' + uri; // depends on control dependency: [if], data = [none] key.setUri(uri); // depends on control dependency: [if], data = [none] key.validate(); // depends on control dependency: [if], data = [none] } return uri; } }
public class class_name { public String toXML() { RepositoryTags tags = RepositoryTags.getInstance(); String eol = System.getProperty( "line.separator" ); // opening tag StringBuffer result = new StringBuffer( 1024 ); result.append( " " ); result.append( tags.getOpeningTagNonClosingById( REFERENCE_DESCRIPTOR ) ); result.append( eol ); // attributes // name String name = this.getAttributeName(); if( name == null ) { name = RepositoryElements.TAG_SUPER; } result.append( " " ); result.append( tags.getAttribute( FIELD_NAME, name ) ); result.append( eol ); // class-ref result.append( " " ); result.append( tags.getAttribute( REFERENCED_CLASS, this.getItemClassName() ) ); result.append( eol ); // proxyReference is optional if( isLazy() ) { result.append( " " ); result.append( tags.getAttribute( PROXY_REFERENCE, "true" ) ); result.append( eol ); result.append( " " ); result.append( tags.getAttribute( PROXY_PREFETCHING_LIMIT, "" + this.getProxyPrefetchingLimit() ) ); result.append( eol ); } //reference refresh is optional, disabled by default if( isRefresh() ) { result.append( " " ); result.append( tags.getAttribute( REFRESH, "true" ) ); result.append( eol ); } //auto retrieve result.append( " " ); result.append( tags.getAttribute( AUTO_RETRIEVE, "" + getCascadeRetrieve() ) ); result.append( eol ); //auto update result.append( " " ); result.append( tags.getAttribute( AUTO_UPDATE, getCascadeAsString( getCascadingStore() ) ) ); result.append( eol ); //auto delete result.append( " " ); result.append( tags.getAttribute( AUTO_DELETE, getCascadeAsString( getCascadingDelete() ) ) ); result.append( eol ); //otm-dependent is optional, disabled by default if( getOtmDependent() ) { result.append( " " ); result.append( tags.getAttribute( OTM_DEPENDENT, "true" ) ); result.append( eol ); } // close opening tag result.append( " >" ); result.append( eol ); // elements // write foreignkey elements for( int i = 0; i < getForeignKeyFields().size(); i++ ) { Object obj = getForeignKeyFields().get( i ); if( obj instanceof Integer ) { String fkId = obj.toString(); result.append( " " ); result.append( tags.getOpeningTagNonClosingById( FOREIGN_KEY ) ); result.append( " " ); result.append( tags.getAttribute( FIELD_ID_REF, fkId ) ); result.append( "/>" ); result.append( eol ); } else { String fk = ( String ) obj; result.append( " " ); result.append( tags.getOpeningTagNonClosingById( FOREIGN_KEY ) ); result.append( " " ); result.append( tags.getAttribute( FIELD_REF, fk ) ); result.append( "/>" ); result.append( eol ); } } // closing tag result.append( " " ); result.append( tags.getClosingTagById( REFERENCE_DESCRIPTOR ) ); result.append( eol ); return result.toString(); } }
public class class_name { public String toXML() { RepositoryTags tags = RepositoryTags.getInstance(); String eol = System.getProperty( "line.separator" ); // opening tag StringBuffer result = new StringBuffer( 1024 ); result.append( " " ); result.append( tags.getOpeningTagNonClosingById( REFERENCE_DESCRIPTOR ) ); result.append( eol ); // attributes // name String name = this.getAttributeName(); if( name == null ) { name = RepositoryElements.TAG_SUPER; // depends on control dependency: [if], data = [none] } result.append( " " ); result.append( tags.getAttribute( FIELD_NAME, name ) ); result.append( eol ); // class-ref result.append( " " ); result.append( tags.getAttribute( REFERENCED_CLASS, this.getItemClassName() ) ); result.append( eol ); // proxyReference is optional if( isLazy() ) { result.append( " " ); // depends on control dependency: [if], data = [none] result.append( tags.getAttribute( PROXY_REFERENCE, "true" ) ); // depends on control dependency: [if], data = [none] result.append( eol ); // depends on control dependency: [if], data = [none] result.append( " " ); // depends on control dependency: [if], data = [none] result.append( tags.getAttribute( PROXY_PREFETCHING_LIMIT, "" + this.getProxyPrefetchingLimit() ) ); // depends on control dependency: [if], data = [none] result.append( eol ); // depends on control dependency: [if], data = [none] } //reference refresh is optional, disabled by default if( isRefresh() ) { result.append( " " ); // depends on control dependency: [if], data = [none] result.append( tags.getAttribute( REFRESH, "true" ) ); // depends on control dependency: [if], data = [none] result.append( eol ); // depends on control dependency: [if], data = [none] } //auto retrieve result.append( " " ); result.append( tags.getAttribute( AUTO_RETRIEVE, "" + getCascadeRetrieve() ) ); result.append( eol ); //auto update result.append( " " ); result.append( tags.getAttribute( AUTO_UPDATE, getCascadeAsString( getCascadingStore() ) ) ); result.append( eol ); //auto delete result.append( " " ); result.append( tags.getAttribute( AUTO_DELETE, getCascadeAsString( getCascadingDelete() ) ) ); result.append( eol ); //otm-dependent is optional, disabled by default if( getOtmDependent() ) { result.append( " " ); // depends on control dependency: [if], data = [none] result.append( tags.getAttribute( OTM_DEPENDENT, "true" ) ); // depends on control dependency: [if], data = [none] result.append( eol ); // depends on control dependency: [if], data = [none] } // close opening tag result.append( " >" ); result.append( eol ); // elements // write foreignkey elements for( int i = 0; i < getForeignKeyFields().size(); i++ ) { Object obj = getForeignKeyFields().get( i ); if( obj instanceof Integer ) { String fkId = obj.toString(); result.append( " " ); // depends on control dependency: [if], data = [none] result.append( tags.getOpeningTagNonClosingById( FOREIGN_KEY ) ); // depends on control dependency: [if], data = [none] result.append( " " ); // depends on control dependency: [if], data = [none] result.append( tags.getAttribute( FIELD_ID_REF, fkId ) ); // depends on control dependency: [if], data = [none] result.append( "/>" ); // depends on control dependency: [if], data = [none] result.append( eol ); // depends on control dependency: [if], data = [none] } else { String fk = ( String ) obj; result.append( " " ); // depends on control dependency: [if], data = [none] result.append( tags.getOpeningTagNonClosingById( FOREIGN_KEY ) ); // depends on control dependency: [if], data = [none] result.append( " " ); // depends on control dependency: [if], data = [none] result.append( tags.getAttribute( FIELD_REF, fk ) ); // depends on control dependency: [if], data = [none] result.append( "/>" ); // depends on control dependency: [if], data = [none] result.append( eol ); // depends on control dependency: [if], data = [none] } } // closing tag result.append( " " ); result.append( tags.getClosingTagById( REFERENCE_DESCRIPTOR ) ); result.append( eol ); return result.toString(); } }
public class class_name { @SuppressWarnings( "fallthrough" ) private void versionNodeAt( AbstractJcrNode node, Name nodeName, MutableCachedNode parentInVersionHistory, boolean forceCopy, SessionCache nodeCache, SessionCache versionHistoryCache ) throws RepositoryException { int onParentVersion = 0; if (forceCopy) { onParentVersion = OnParentVersionAction.COPY; } else { onParentVersion = node.getDefinition().getOnParentVersion(); } NodeKey key = parentInVersionHistory.getKey().withRandomId(); switch (onParentVersion) { case OnParentVersionAction.ABORT: throw new VersionException(JcrI18n.cannotCheckinNodeWithAbortChildNode.text(nodeName, node.getParent().getName())); case OnParentVersionAction.VERSION: if (node.isNodeType(JcrMixLexicon.VERSIONABLE)) { // The frozen node should reference the version history of the node ... JcrVersionHistoryNode history = node.getVersionHistory(); org.modeshape.jcr.value.Property primaryType = propertyFactory().create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.VERSIONED_CHILD); Reference childVersionHistoryValue = session.referenceFactory().create(history.key(), true); org.modeshape.jcr.value.Property childVersionHistory = propertyFactory().create( JcrLexicon.CHILD_VERSION_HISTORY, childVersionHistoryValue); parentInVersionHistory.createChild(versionHistoryCache, key, nodeName, primaryType, childVersionHistory); return; } // Otherwise, treat it as a copy, as per section 3.13.9 bullet item 5 in JSR-283, so DO NOT break ... case OnParentVersionAction.COPY: // Per section 3.13.9 item 5 in JSR-283, an OPV of COPY or VERSION (if not versionable) // results in COPY behavior "regardless of the OPV values of the sub-items". // We can achieve this by making the onParentVersionAction always COPY for the // recursive call ... forceCopy = true; PropertyFactory factory = propertyFactory(); List<Property> props = new LinkedList<Property>(); if (node.isShared()) { // This is a shared node, so we should store a proxy to the shareable node ... props.add(factory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FROZEN_NODE)); props.add(factory.create(JcrLexicon.FROZEN_PRIMARY_TYPE, ModeShapeLexicon.SHARE)); props.add(factory.create(JcrLexicon.FROZEN_UUID, node.getIdentifier())); props.add(factory.create(JcrLexicon.UUID, key)); parentInVersionHistory.createChild(versionHistoryCache, key, nodeName, props); // The proxies to shareable nodes never have children (nor versionable properties), so we're done ... return; } // But the copy needs to be a 'nt:frozenNode', so that it doesn't compete with the actual node // (outside of version history) ... Name primaryTypeName = node.getPrimaryTypeName(); Set<Name> mixinTypeNames = node.getMixinTypeNames(); props.add(factory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FROZEN_NODE)); props.add(factory.create(JcrLexicon.FROZEN_PRIMARY_TYPE, primaryTypeName)); props.add(factory.create(JcrLexicon.FROZEN_MIXIN_TYPES, mixinTypeNames)); props.add(factory.create(JcrLexicon.FROZEN_UUID, node.getIdentifier())); props.add(factory.create(JcrLexicon.UUID, key)); addVersionedPropertiesFor(node, forceCopy, props); MutableCachedNode newCopy = parentInVersionHistory.createChild(versionHistoryCache, key, nodeName, props); // Now process the children of the versionable node ... NodeKey parentKey = node.key(); for (ChildReference childRef : node.node().getChildReferences(nodeCache)) { AbstractJcrNode child = session.node(childRef.getKey(), null, parentKey); versionNodeAt(child, childRef.getName(), newCopy, forceCopy, nodeCache, versionHistoryCache); } return; case OnParentVersionAction.INITIALIZE: case OnParentVersionAction.COMPUTE: case OnParentVersionAction.IGNORE: // Do nothing for these. No built-in types require initialize or compute for child nodes. return; default: throw new IllegalStateException("Unexpected value: " + onParentVersion); } } }
public class class_name { @SuppressWarnings( "fallthrough" ) private void versionNodeAt( AbstractJcrNode node, Name nodeName, MutableCachedNode parentInVersionHistory, boolean forceCopy, SessionCache nodeCache, SessionCache versionHistoryCache ) throws RepositoryException { int onParentVersion = 0; if (forceCopy) { onParentVersion = OnParentVersionAction.COPY; } else { onParentVersion = node.getDefinition().getOnParentVersion(); } NodeKey key = parentInVersionHistory.getKey().withRandomId(); switch (onParentVersion) { case OnParentVersionAction.ABORT: throw new VersionException(JcrI18n.cannotCheckinNodeWithAbortChildNode.text(nodeName, node.getParent().getName())); case OnParentVersionAction.VERSION: if (node.isNodeType(JcrMixLexicon.VERSIONABLE)) { // The frozen node should reference the version history of the node ... JcrVersionHistoryNode history = node.getVersionHistory(); org.modeshape.jcr.value.Property primaryType = propertyFactory().create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.VERSIONED_CHILD); Reference childVersionHistoryValue = session.referenceFactory().create(history.key(), true); org.modeshape.jcr.value.Property childVersionHistory = propertyFactory().create( JcrLexicon.CHILD_VERSION_HISTORY, childVersionHistoryValue); parentInVersionHistory.createChild(versionHistoryCache, key, nodeName, primaryType, childVersionHistory); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // Otherwise, treat it as a copy, as per section 3.13.9 bullet item 5 in JSR-283, so DO NOT break ... case OnParentVersionAction.COPY: // Per section 3.13.9 item 5 in JSR-283, an OPV of COPY or VERSION (if not versionable) // results in COPY behavior "regardless of the OPV values of the sub-items". // We can achieve this by making the onParentVersionAction always COPY for the // recursive call ... forceCopy = true; PropertyFactory factory = propertyFactory(); List<Property> props = new LinkedList<Property>(); if (node.isShared()) { // This is a shared node, so we should store a proxy to the shareable node ... props.add(factory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FROZEN_NODE)); // depends on control dependency: [if], data = [none] props.add(factory.create(JcrLexicon.FROZEN_PRIMARY_TYPE, ModeShapeLexicon.SHARE)); // depends on control dependency: [if], data = [none] props.add(factory.create(JcrLexicon.FROZEN_UUID, node.getIdentifier())); // depends on control dependency: [if], data = [none] props.add(factory.create(JcrLexicon.UUID, key)); // depends on control dependency: [if], data = [none] parentInVersionHistory.createChild(versionHistoryCache, key, nodeName, props); // depends on control dependency: [if], data = [none] // The proxies to shareable nodes never have children (nor versionable properties), so we're done ... return; // depends on control dependency: [if], data = [none] } // But the copy needs to be a 'nt:frozenNode', so that it doesn't compete with the actual node // (outside of version history) ... Name primaryTypeName = node.getPrimaryTypeName(); Set<Name> mixinTypeNames = node.getMixinTypeNames(); props.add(factory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FROZEN_NODE)); props.add(factory.create(JcrLexicon.FROZEN_PRIMARY_TYPE, primaryTypeName)); props.add(factory.create(JcrLexicon.FROZEN_MIXIN_TYPES, mixinTypeNames)); props.add(factory.create(JcrLexicon.FROZEN_UUID, node.getIdentifier())); props.add(factory.create(JcrLexicon.UUID, key)); addVersionedPropertiesFor(node, forceCopy, props); MutableCachedNode newCopy = parentInVersionHistory.createChild(versionHistoryCache, key, nodeName, props); // Now process the children of the versionable node ... NodeKey parentKey = node.key(); for (ChildReference childRef : node.node().getChildReferences(nodeCache)) { AbstractJcrNode child = session.node(childRef.getKey(), null, parentKey); versionNodeAt(child, childRef.getName(), newCopy, forceCopy, nodeCache, versionHistoryCache); // depends on control dependency: [for], data = [childRef] } return; case OnParentVersionAction.INITIALIZE: case OnParentVersionAction.COMPUTE: case OnParentVersionAction.IGNORE: // Do nothing for these. No built-in types require initialize or compute for child nodes. return; default: throw new IllegalStateException("Unexpected value: " + onParentVersion); } } }
public class class_name { public DescribeEnvironmentManagedActionHistoryResult withManagedActionHistoryItems(ManagedActionHistoryItem... managedActionHistoryItems) { if (this.managedActionHistoryItems == null) { setManagedActionHistoryItems(new com.amazonaws.internal.SdkInternalList<ManagedActionHistoryItem>(managedActionHistoryItems.length)); } for (ManagedActionHistoryItem ele : managedActionHistoryItems) { this.managedActionHistoryItems.add(ele); } return this; } }
public class class_name { public DescribeEnvironmentManagedActionHistoryResult withManagedActionHistoryItems(ManagedActionHistoryItem... managedActionHistoryItems) { if (this.managedActionHistoryItems == null) { setManagedActionHistoryItems(new com.amazonaws.internal.SdkInternalList<ManagedActionHistoryItem>(managedActionHistoryItems.length)); // depends on control dependency: [if], data = [none] } for (ManagedActionHistoryItem ele : managedActionHistoryItems) { this.managedActionHistoryItems.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static String concatEntityHref( String baseUri, String qualifiedEntityName, Object entityIdValue) { if (null == qualifiedEntityName) { qualifiedEntityName = ""; } return String.format( "%s/%s/%s", baseUri, encodePathSegment(qualifiedEntityName), encodePathSegment(DataConverter.toString(entityIdValue))); } }
public class class_name { public static String concatEntityHref( String baseUri, String qualifiedEntityName, Object entityIdValue) { if (null == qualifiedEntityName) { qualifiedEntityName = ""; // depends on control dependency: [if], data = [none] } return String.format( "%s/%s/%s", baseUri, encodePathSegment(qualifiedEntityName), encodePathSegment(DataConverter.toString(entityIdValue))); } }
public class class_name { public static void main(String[] args) throws Exception { parseArgs(args); GenMunger rawMunger; rawMunger = (hex.genmodel.GenMunger) Class.forName(assemblyClassName).newInstance(); BufferedReader input = new BufferedReader(new FileReader(inputCSVFileName)); BufferedWriter output = new BufferedWriter(new FileWriter(outputCSVFileName)); // Emit outputCSV column names. String[] rawHeader = rawMunger.outNames(); StringBuilder header = new StringBuilder(); for(int i=0;i<rawHeader.length;++i) { header.append("\"").append(rawHeader[i]).append("\""); if( i < rawHeader.length - 1 ) header.append(","); } output.write(header.toString()); output.write("\n"); // Loop over inputCSV one row at a time. int lineNum = 0; String line; try { while ((line = input.readLine()) != null) { lineNum++; // skip the header. if (lineNum == 1) continue; // Parse the CSV line. Somewhat handles quoted commas. But this ain't no parser test! RowData row; try { row = parseDataRow(line, rawMunger); } catch( NumberFormatException nfe) { nfe.printStackTrace(); System.out.println("Failed to parse row: " + lineNum ); throw new RuntimeException(); } RowData mungedRow = rawMunger.fit(row); for(int i=0; i<rawMunger.outNames().length;++i) { Object val = mungedRow==null?Double.NaN:mungedRow.get(rawMunger.outNames()[i]); if( val instanceof Double ) output.write(String.valueOf(val)); else output.write("\"" + val + "\""); if( i < rawMunger.outNames().length - 1) output.write(","); } output.write("\n"); } } catch (Exception e) { System.out.println("Caught exception on line " + lineNum); System.out.println(""); e.printStackTrace(); System.exit(1); } finally { // Clean up. output.close(); input.close(); } // Predictions were successfully generated. Calling program can now compare them with something. System.exit(0); } }
public class class_name { public static void main(String[] args) throws Exception { parseArgs(args); GenMunger rawMunger; rawMunger = (hex.genmodel.GenMunger) Class.forName(assemblyClassName).newInstance(); BufferedReader input = new BufferedReader(new FileReader(inputCSVFileName)); BufferedWriter output = new BufferedWriter(new FileWriter(outputCSVFileName)); // Emit outputCSV column names. String[] rawHeader = rawMunger.outNames(); StringBuilder header = new StringBuilder(); for(int i=0;i<rawHeader.length;++i) { header.append("\"").append(rawHeader[i]).append("\""); if( i < rawHeader.length - 1 ) header.append(","); } output.write(header.toString()); output.write("\n"); // Loop over inputCSV one row at a time. int lineNum = 0; String line; try { while ((line = input.readLine()) != null) { lineNum++; // depends on control dependency: [while], data = [none] // skip the header. if (lineNum == 1) continue; // Parse the CSV line. Somewhat handles quoted commas. But this ain't no parser test! RowData row; try { row = parseDataRow(line, rawMunger); // depends on control dependency: [try], data = [none] } catch( NumberFormatException nfe) { nfe.printStackTrace(); System.out.println("Failed to parse row: " + lineNum ); throw new RuntimeException(); } // depends on control dependency: [catch], data = [none] RowData mungedRow = rawMunger.fit(row); for(int i=0; i<rawMunger.outNames().length;++i) { Object val = mungedRow==null?Double.NaN:mungedRow.get(rawMunger.outNames()[i]); if( val instanceof Double ) output.write(String.valueOf(val)); else output.write("\"" + val + "\""); if( i < rawMunger.outNames().length - 1) output.write(","); } output.write("\n"); // depends on control dependency: [while], data = [none] } } catch (Exception e) { System.out.println("Caught exception on line " + lineNum); System.out.println(""); e.printStackTrace(); System.exit(1); } finally { // Clean up. output.close(); input.close(); } // Predictions were successfully generated. Calling program can now compare them with something. System.exit(0); } }
public class class_name { private SchemaManager getSchemaManagerForPu(final String persistenceUnit) { SchemaManager schemaManager = null; Map<String, Object> externalProperties = KunderaCoreUtils.getExternalProperties(persistenceUnit, externalPropertyMap, persistenceUnits); if (getSchemaProperty(persistenceUnit, externalProperties) != null && !getSchemaProperty(persistenceUnit, externalProperties).isEmpty()) { ClientFactory clientFactory = ClientResolver.getClientFactory(persistenceUnit); schemaManager = clientFactory != null ? clientFactory.getSchemaManager(externalProperties) : null; } return schemaManager; } }
public class class_name { private SchemaManager getSchemaManagerForPu(final String persistenceUnit) { SchemaManager schemaManager = null; Map<String, Object> externalProperties = KunderaCoreUtils.getExternalProperties(persistenceUnit, externalPropertyMap, persistenceUnits); if (getSchemaProperty(persistenceUnit, externalProperties) != null && !getSchemaProperty(persistenceUnit, externalProperties).isEmpty()) { ClientFactory clientFactory = ClientResolver.getClientFactory(persistenceUnit); schemaManager = clientFactory != null ? clientFactory.getSchemaManager(externalProperties) : null; // depends on control dependency: [if], data = [null] } return schemaManager; } }
public class class_name { public void marshall(PutLifecycleEventHookExecutionStatusRequest putLifecycleEventHookExecutionStatusRequest, ProtocolMarshaller protocolMarshaller) { if (putLifecycleEventHookExecutionStatusRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putLifecycleEventHookExecutionStatusRequest.getDeploymentId(), DEPLOYMENTID_BINDING); protocolMarshaller.marshall(putLifecycleEventHookExecutionStatusRequest.getLifecycleEventHookExecutionId(), LIFECYCLEEVENTHOOKEXECUTIONID_BINDING); protocolMarshaller.marshall(putLifecycleEventHookExecutionStatusRequest.getStatus(), STATUS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PutLifecycleEventHookExecutionStatusRequest putLifecycleEventHookExecutionStatusRequest, ProtocolMarshaller protocolMarshaller) { if (putLifecycleEventHookExecutionStatusRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putLifecycleEventHookExecutionStatusRequest.getDeploymentId(), DEPLOYMENTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putLifecycleEventHookExecutionStatusRequest.getLifecycleEventHookExecutionId(), LIFECYCLEEVENTHOOKEXECUTIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putLifecycleEventHookExecutionStatusRequest.getStatus(), STATUS_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 void close() { boolean performClose = false; ; synchronized (this) { if (!closing && state == CHANNEL_OPEN) { performClose = closing = true; } } if (performClose) { synchronized (listeners) { for (Enumeration<ChannelEventListener> e = listeners.elements(); e .hasMoreElements();) { (e.nextElement()).channelClosing(this); } } try { // Close the ChannelOutputStream out.close(!isLocalEOF); // Send our close message ByteArrayWriter msg = new ByteArrayWriter(5); msg.write(SSH_MSG_CHANNEL_CLOSE); msg.writeInt(remoteid); try { if (Log.isDebugEnabled()) { Log.debug(this, "Sending SSH_MSG_CHANNEL_CLOSE id=" + channelid + " rid=" + remoteid); } connection.sendMessage(msg.toByteArray(), true); } catch (SshException ex1) { if (Log.isDebugEnabled()) { Log.debug(this, "Exception attempting to send SSH_MSG_CHANNEL_CLOSE id=" + channelid + " rid=" + remoteid, ex1); } } finally { msg.close(); } this.state = CHANNEL_CLOSED; } catch (EOFException eof) { // Ignore this is the message store informing of close/eof } catch (SshIOException ex) { if (Log.isDebugEnabled()) { Log.debug(this, "SSH Exception during close reason=" + ex.getRealException().getReason() + " id=" + channelid + " rid=" + remoteid, ex.getRealException()); } // IO Error during close so the connection has dropped connection.transport.disconnect( TransportProtocol.CONNECTION_LOST, "IOException during channel close: " + ex.getMessage()); } catch (IOException ex) { if (Log.isDebugEnabled()) { Log.debug(this, "Exception during close id=" + channelid + " rid=" + remoteid, ex); } // IO Error during close so the connection has dropped connection.transport.disconnect( TransportProtocol.CONNECTION_LOST, "IOException during channel close: " + ex.getMessage()); } finally { checkCloseStatus(ms.isClosed()); } } } }
public class class_name { public void close() { boolean performClose = false; ; synchronized (this) { if (!closing && state == CHANNEL_OPEN) { performClose = closing = true; // depends on control dependency: [if], data = [none] } } if (performClose) { synchronized (listeners) { // depends on control dependency: [if], data = [none] for (Enumeration<ChannelEventListener> e = listeners.elements(); e .hasMoreElements();) { (e.nextElement()).channelClosing(this); // depends on control dependency: [for], data = [e] } } try { // Close the ChannelOutputStream out.close(!isLocalEOF); // depends on control dependency: [try], data = [none] // Send our close message ByteArrayWriter msg = new ByteArrayWriter(5); msg.write(SSH_MSG_CHANNEL_CLOSE); // depends on control dependency: [try], data = [none] msg.writeInt(remoteid); // depends on control dependency: [try], data = [none] try { if (Log.isDebugEnabled()) { Log.debug(this, "Sending SSH_MSG_CHANNEL_CLOSE id=" + channelid + " rid=" + remoteid); // depends on control dependency: [if], data = [none] } connection.sendMessage(msg.toByteArray(), true); // depends on control dependency: [try], data = [none] } catch (SshException ex1) { if (Log.isDebugEnabled()) { Log.debug(this, "Exception attempting to send SSH_MSG_CHANNEL_CLOSE id=" + channelid + " rid=" + remoteid, ex1); // depends on control dependency: [if], data = [none] } } finally { // depends on control dependency: [catch], data = [none] msg.close(); } this.state = CHANNEL_CLOSED; // depends on control dependency: [try], data = [none] } catch (EOFException eof) { // Ignore this is the message store informing of close/eof } catch (SshIOException ex) { // depends on control dependency: [catch], data = [none] if (Log.isDebugEnabled()) { Log.debug(this, "SSH Exception during close reason=" + ex.getRealException().getReason() + " id=" + channelid + " rid=" + remoteid, ex.getRealException()); // depends on control dependency: [if], data = [none] } // IO Error during close so the connection has dropped connection.transport.disconnect( TransportProtocol.CONNECTION_LOST, "IOException during channel close: " + ex.getMessage()); } catch (IOException ex) { // depends on control dependency: [catch], data = [none] if (Log.isDebugEnabled()) { Log.debug(this, "Exception during close id=" + channelid + " rid=" + remoteid, ex); // depends on control dependency: [if], data = [none] } // IO Error during close so the connection has dropped connection.transport.disconnect( TransportProtocol.CONNECTION_LOST, "IOException during channel close: " + ex.getMessage()); } finally { // depends on control dependency: [catch], data = [none] checkCloseStatus(ms.isClosed()); } } } }
public class class_name { public JSONWriter with(TreeCodec tc) { if (_treeCodec == tc) { return this; } return _with(_features, _writerLocator, tc); } }
public class class_name { public JSONWriter with(TreeCodec tc) { if (_treeCodec == tc) { return this; // depends on control dependency: [if], data = [none] } return _with(_features, _writerLocator, tc); } }
public class class_name { public void marshall(ProvisioningParameter provisioningParameter, ProtocolMarshaller protocolMarshaller) { if (provisioningParameter == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(provisioningParameter.getKey(), KEY_BINDING); protocolMarshaller.marshall(provisioningParameter.getValue(), VALUE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ProvisioningParameter provisioningParameter, ProtocolMarshaller protocolMarshaller) { if (provisioningParameter == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(provisioningParameter.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(provisioningParameter.getValue(), VALUE_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 CmsAppCategoryNode buildHierarchy() { // STEP 0: Initialize everything and sort categories by priority Collections.sort(m_appCategoryList, new Comparator<I_CmsAppCategory>() { public int compare(I_CmsAppCategory cat1, I_CmsAppCategory cat2) { return ComparisonChain.start().compare(cat1.getPriority(), cat2.getPriority()).result(); } }); m_rootNode = new CmsAppCategoryNode(); m_nodes.clear(); m_nodes.put(null, m_rootNode); // STEP 1: Create a node for each category for (I_CmsAppCategory category : m_appCategoryList) { m_nodes.put(category.getId(), new CmsAppCategoryNode(category)); } // STEP 2: Assign category nodes to nodes for their parent category for (CmsAppCategoryNode node : m_nodes.values()) { if (node != m_rootNode) { addNodeToItsParent(node); } } // STEP 3: Assign app configs to category nodes for (I_CmsWorkplaceAppConfiguration appConfig : m_appConfigs) { addAppConfigToCategory(appConfig); } // STEP 4: Validate whether there are unused categories / apps Set<String> usedNodes = findReachableNodes(m_rootNode, new HashSet<String>()); if (usedNodes.size() < m_nodes.size()) { LOG.warn("Unused app categories: " + Sets.difference(m_nodes.keySet(), usedNodes)); } Set<String> unusedApps = Sets.newHashSet(); for (I_CmsWorkplaceAppConfiguration appConfig : m_appConfigs) { if (!usedNodes.contains(appConfig.getAppCategory())) { unusedApps.add(appConfig.getId()); } } if (unusedApps.size() > 0) { LOG.warn("Unused apps: " + unusedApps); } // STEP 5: Remove parts of the hierarchy which don't contain any apps m_rootNode.removeApplessSubtrees(); // STEP 6: Sort all categories and app configurations for each node m_rootNode.sortRecursively(); return m_rootNode; } }
public class class_name { public CmsAppCategoryNode buildHierarchy() { // STEP 0: Initialize everything and sort categories by priority Collections.sort(m_appCategoryList, new Comparator<I_CmsAppCategory>() { public int compare(I_CmsAppCategory cat1, I_CmsAppCategory cat2) { return ComparisonChain.start().compare(cat1.getPriority(), cat2.getPriority()).result(); } }); m_rootNode = new CmsAppCategoryNode(); m_nodes.clear(); m_nodes.put(null, m_rootNode); // STEP 1: Create a node for each category for (I_CmsAppCategory category : m_appCategoryList) { m_nodes.put(category.getId(), new CmsAppCategoryNode(category)); // depends on control dependency: [for], data = [category] } // STEP 2: Assign category nodes to nodes for their parent category for (CmsAppCategoryNode node : m_nodes.values()) { if (node != m_rootNode) { addNodeToItsParent(node); // depends on control dependency: [if], data = [(node] } } // STEP 3: Assign app configs to category nodes for (I_CmsWorkplaceAppConfiguration appConfig : m_appConfigs) { addAppConfigToCategory(appConfig); // depends on control dependency: [for], data = [appConfig] } // STEP 4: Validate whether there are unused categories / apps Set<String> usedNodes = findReachableNodes(m_rootNode, new HashSet<String>()); if (usedNodes.size() < m_nodes.size()) { LOG.warn("Unused app categories: " + Sets.difference(m_nodes.keySet(), usedNodes)); // depends on control dependency: [if], data = [none] } Set<String> unusedApps = Sets.newHashSet(); for (I_CmsWorkplaceAppConfiguration appConfig : m_appConfigs) { if (!usedNodes.contains(appConfig.getAppCategory())) { unusedApps.add(appConfig.getId()); // depends on control dependency: [if], data = [none] } } if (unusedApps.size() > 0) { LOG.warn("Unused apps: " + unusedApps); // depends on control dependency: [if], data = [none] } // STEP 5: Remove parts of the hierarchy which don't contain any apps m_rootNode.removeApplessSubtrees(); // STEP 6: Sort all categories and app configurations for each node m_rootNode.sortRecursively(); return m_rootNode; } }
public class class_name { void unregister(ResourceMonitorImpl monitorImpl) { Set<Entry<WatchKey, ResourceMonitorImpl>> entrySet = keys.entrySet(); Iterator<Entry<WatchKey, ResourceMonitorImpl>> iterator = entrySet.iterator(); while (iterator.hasNext()) { Entry<WatchKey, ResourceMonitorImpl> next = iterator.next(); if (next.getValue() == monitorImpl) { next.getKey().cancel(); iterator.remove(); } } } }
public class class_name { void unregister(ResourceMonitorImpl monitorImpl) { Set<Entry<WatchKey, ResourceMonitorImpl>> entrySet = keys.entrySet(); Iterator<Entry<WatchKey, ResourceMonitorImpl>> iterator = entrySet.iterator(); while (iterator.hasNext()) { Entry<WatchKey, ResourceMonitorImpl> next = iterator.next(); if (next.getValue() == monitorImpl) { next.getKey().cancel(); // depends on control dependency: [if], data = [none] iterator.remove(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public void updateWayNameVisibility(boolean isVisible) { wayNameView.updateVisibility(isVisible); if (navigationMap != null) { navigationMap.updateWaynameQueryMap(isVisible); } } }
public class class_name { @Override public void updateWayNameVisibility(boolean isVisible) { wayNameView.updateVisibility(isVisible); if (navigationMap != null) { navigationMap.updateWaynameQueryMap(isVisible); // depends on control dependency: [if], data = [none] } } }
public class class_name { public I_CmsResourceType getDefaultTypeForName(String resourcename) throws CmsException { String typeName = null; String suffix = null; if (CmsStringUtil.isNotEmpty(resourcename)) { int pos = resourcename.lastIndexOf('.'); if (pos >= 0) { suffix = resourcename.substring(pos); if (CmsStringUtil.isNotEmpty(suffix)) { suffix = suffix.toLowerCase(); typeName = m_configuration.m_extensionMappings.get(suffix); } } } if (typeName == null) { // use default type "plain" typeName = CmsResourceTypePlain.getStaticTypeName(); } if (CmsLog.INIT.isDebugEnabled()) { CmsLog.INIT.debug(Messages.get().getBundle().key(Messages.INIT_GET_RESTYPE_2, typeName, suffix)); } // look up and return the resource type return getResourceType(typeName); } }
public class class_name { public I_CmsResourceType getDefaultTypeForName(String resourcename) throws CmsException { String typeName = null; String suffix = null; if (CmsStringUtil.isNotEmpty(resourcename)) { int pos = resourcename.lastIndexOf('.'); if (pos >= 0) { suffix = resourcename.substring(pos); // depends on control dependency: [if], data = [(pos] if (CmsStringUtil.isNotEmpty(suffix)) { suffix = suffix.toLowerCase(); // depends on control dependency: [if], data = [none] typeName = m_configuration.m_extensionMappings.get(suffix); // depends on control dependency: [if], data = [none] } } } if (typeName == null) { // use default type "plain" typeName = CmsResourceTypePlain.getStaticTypeName(); } if (CmsLog.INIT.isDebugEnabled()) { CmsLog.INIT.debug(Messages.get().getBundle().key(Messages.INIT_GET_RESTYPE_2, typeName, suffix)); } // look up and return the resource type return getResourceType(typeName); } }
public class class_name { @Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKEINTERFACE) { KeyType type = isKeyAccessMethod(seen); if (type != null) { int numParms = SignatureUtils.getNumParameters(getSigConstantOperand()); if (stack.getStackDepth() >= numParms) { OpcodeStack.Item item = stack.getStackItem(numParms - 1); String parmName = (String) item.getConstant(); if (parmName != null) { String upperParmName = parmName.toUpperCase(Locale.getDefault()); Map<String, Map<String, List<SourceInfo>>> typeMap = parmInfo.get(KeyType.PARAMETER); Map<String, List<SourceInfo>> parmCaseInfo = typeMap.get(upperParmName); if (parmCaseInfo == null) { parmCaseInfo = new HashMap<>(); typeMap.put(upperParmName, parmCaseInfo); } List<SourceInfo> annotations = parmCaseInfo.get(parmName); if (annotations == null) { annotations = new ArrayList<>(); parmCaseInfo.put(parmName, annotations); } annotations.add(new SourceInfo(getClassName(), getMethodName(), getMethodSig(), getMethod().isStatic(), SourceLineAnnotation.fromVisitedInstruction(getClassContext(), this, getPC()))); } } } } } finally { stack.sawOpcode(this, seen); } } }
public class class_name { @Override public void sawOpcode(int seen) { try { stack.precomputation(this); // depends on control dependency: [try], data = [none] if (seen == Const.INVOKEINTERFACE) { KeyType type = isKeyAccessMethod(seen); if (type != null) { int numParms = SignatureUtils.getNumParameters(getSigConstantOperand()); if (stack.getStackDepth() >= numParms) { OpcodeStack.Item item = stack.getStackItem(numParms - 1); String parmName = (String) item.getConstant(); if (parmName != null) { String upperParmName = parmName.toUpperCase(Locale.getDefault()); Map<String, Map<String, List<SourceInfo>>> typeMap = parmInfo.get(KeyType.PARAMETER); Map<String, List<SourceInfo>> parmCaseInfo = typeMap.get(upperParmName); if (parmCaseInfo == null) { parmCaseInfo = new HashMap<>(); // depends on control dependency: [if], data = [none] typeMap.put(upperParmName, parmCaseInfo); // depends on control dependency: [if], data = [none] } List<SourceInfo> annotations = parmCaseInfo.get(parmName); if (annotations == null) { annotations = new ArrayList<>(); // depends on control dependency: [if], data = [none] parmCaseInfo.put(parmName, annotations); // depends on control dependency: [if], data = [none] } annotations.add(new SourceInfo(getClassName(), getMethodName(), getMethodSig(), getMethod().isStatic(), SourceLineAnnotation.fromVisitedInstruction(getClassContext(), this, getPC()))); // depends on control dependency: [if], data = [none] } } } } } finally { stack.sawOpcode(this, seen); } } }
public class class_name { private JXTable getUrlsTable() { if (urlsTable == null) { // Create the table with a default, empty TableModel and the proper settings urlsTable = new ZapTable(EMPTY_URLS_TABLE_MODEL); urlsTable.setColumnSelectionAllowed(false); urlsTable.setCellSelectionEnabled(false); urlsTable.setRowSelectionAllowed(true); urlsTable.setAutoCreateRowSorter(true); urlsTable.setAutoCreateColumnsFromModel(false); urlsTable.getColumnExt(0).setCellRenderer( new DefaultTableRenderer(new MappedValue(StringValues.EMPTY, IconValues.NONE), JLabel.CENTER)); urlsTable.getColumnExt(0).setHighlighters(new ProcessedCellItemIconHighlighter(0)); urlsTable.getColumnModel().getColumn(0).setMinWidth(80); urlsTable.getColumnModel().getColumn(0).setPreferredWidth(90); // processed urlsTable.getColumnModel().getColumn(1).setMinWidth(60); urlsTable.getColumnModel().getColumn(1).setPreferredWidth(70); // method urlsTable.getColumnModel().getColumn(2).setMinWidth(300); // name urlsTable.getColumnModel().getColumn(3).setMinWidth(50); urlsTable.getColumnModel().getColumn(3).setPreferredWidth(250); // flags urlsTable.setName(PANEL_NAME); urlsTable.setDoubleBuffered(true); urlsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); urlsTable.setComponentPopupMenu(new JPopupMenu() { private static final long serialVersionUID = 6608291059686282641L; @Override public void show(Component invoker, int x, int y) { View.getSingleton().getPopupMenu().show(invoker, x, y); } }); } return urlsTable; } }
public class class_name { private JXTable getUrlsTable() { if (urlsTable == null) { // Create the table with a default, empty TableModel and the proper settings urlsTable = new ZapTable(EMPTY_URLS_TABLE_MODEL); // depends on control dependency: [if], data = [none] urlsTable.setColumnSelectionAllowed(false); // depends on control dependency: [if], data = [none] urlsTable.setCellSelectionEnabled(false); // depends on control dependency: [if], data = [none] urlsTable.setRowSelectionAllowed(true); // depends on control dependency: [if], data = [none] urlsTable.setAutoCreateRowSorter(true); // depends on control dependency: [if], data = [none] urlsTable.setAutoCreateColumnsFromModel(false); // depends on control dependency: [if], data = [none] urlsTable.getColumnExt(0).setCellRenderer( new DefaultTableRenderer(new MappedValue(StringValues.EMPTY, IconValues.NONE), JLabel.CENTER)); // depends on control dependency: [if], data = [none] urlsTable.getColumnExt(0).setHighlighters(new ProcessedCellItemIconHighlighter(0)); // depends on control dependency: [if], data = [none] urlsTable.getColumnModel().getColumn(0).setMinWidth(80); // depends on control dependency: [if], data = [none] urlsTable.getColumnModel().getColumn(0).setPreferredWidth(90); // processed // depends on control dependency: [if], data = [none] urlsTable.getColumnModel().getColumn(1).setMinWidth(60); // depends on control dependency: [if], data = [none] urlsTable.getColumnModel().getColumn(1).setPreferredWidth(70); // method // depends on control dependency: [if], data = [none] urlsTable.getColumnModel().getColumn(2).setMinWidth(300); // name // depends on control dependency: [if], data = [none] urlsTable.getColumnModel().getColumn(3).setMinWidth(50); // depends on control dependency: [if], data = [none] urlsTable.getColumnModel().getColumn(3).setPreferredWidth(250); // flags // depends on control dependency: [if], data = [none] urlsTable.setName(PANEL_NAME); // depends on control dependency: [if], data = [none] urlsTable.setDoubleBuffered(true); // depends on control dependency: [if], data = [none] urlsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); // depends on control dependency: [if], data = [none] urlsTable.setComponentPopupMenu(new JPopupMenu() { private static final long serialVersionUID = 6608291059686282641L; @Override public void show(Component invoker, int x, int y) { View.getSingleton().getPopupMenu().show(invoker, x, y); } }); // depends on control dependency: [if], data = [none] } return urlsTable; } }
public class class_name { public final srecParser.expression_return expression() throws RecognitionException { srecParser.expression_return retval = new srecParser.expression_return(); retval.start = input.LT(1); CommonTree root_0 = null; srecParser.method_call_or_varref_return method_call_or_varref9 = null; srecParser.assignment_return assignment10 = null; srecParser.method_def_return method_def11 = null; try { // /home/victor/srec/core/src/main/antlr/srec.g:55:2: ( method_call_or_varref | assignment | method_def ) int alt5=3; int LA5_0 = input.LA(1); if ( (LA5_0==ID) ) { int LA5_1 = input.LA(2); if ( (LA5_1==EOF||(LA5_1>=STRING && LA5_1<=NULL)||LA5_1==29) ) { alt5=1; } else if ( (LA5_1==32) ) { alt5=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 5, 1, input); throw nvae; } } else if ( (LA5_0==33) ) { alt5=3; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 5, 0, input); throw nvae; } switch (alt5) { case 1 : // /home/victor/srec/core/src/main/antlr/srec.g:55:4: method_call_or_varref { root_0 = (CommonTree)adaptor.nil(); pushFollow(FOLLOW_method_call_or_varref_in_expression202); method_call_or_varref9=method_call_or_varref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, method_call_or_varref9.getTree()); } break; case 2 : // /home/victor/srec/core/src/main/antlr/srec.g:55:28: assignment { root_0 = (CommonTree)adaptor.nil(); pushFollow(FOLLOW_assignment_in_expression206); assignment10=assignment(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, assignment10.getTree()); } break; case 3 : // /home/victor/srec/core/src/main/antlr/srec.g:55:41: method_def { root_0 = (CommonTree)adaptor.nil(); pushFollow(FOLLOW_method_def_in_expression210); method_def11=method_def(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, method_def11.getTree()); } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } }
public class class_name { public final srecParser.expression_return expression() throws RecognitionException { srecParser.expression_return retval = new srecParser.expression_return(); retval.start = input.LT(1); CommonTree root_0 = null; srecParser.method_call_or_varref_return method_call_or_varref9 = null; srecParser.assignment_return assignment10 = null; srecParser.method_def_return method_def11 = null; try { // /home/victor/srec/core/src/main/antlr/srec.g:55:2: ( method_call_or_varref | assignment | method_def ) int alt5=3; int LA5_0 = input.LA(1); if ( (LA5_0==ID) ) { int LA5_1 = input.LA(2); if ( (LA5_1==EOF||(LA5_1>=STRING && LA5_1<=NULL)||LA5_1==29) ) { alt5=1; // depends on control dependency: [if], data = [none] } else if ( (LA5_1==32) ) { alt5=2; // depends on control dependency: [if], data = [none] } else { if (state.backtracking>0) {state.failed=true; return retval;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] NoViableAltException nvae = new NoViableAltException("", 5, 1, input); throw nvae; } } else if ( (LA5_0==33) ) { alt5=3; // depends on control dependency: [if], data = [none] } else { if (state.backtracking>0) {state.failed=true; return retval;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] NoViableAltException nvae = new NoViableAltException("", 5, 0, input); throw nvae; } switch (alt5) { case 1 : // /home/victor/srec/core/src/main/antlr/srec.g:55:4: method_call_or_varref { root_0 = (CommonTree)adaptor.nil(); pushFollow(FOLLOW_method_call_or_varref_in_expression202); method_call_or_varref9=method_call_or_varref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, method_call_or_varref9.getTree()); } break; case 2 : // /home/victor/srec/core/src/main/antlr/srec.g:55:28: assignment { root_0 = (CommonTree)adaptor.nil(); pushFollow(FOLLOW_assignment_in_expression206); assignment10=assignment(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, assignment10.getTree()); } break; case 3 : // /home/victor/srec/core/src/main/antlr/srec.g:55:41: method_def { root_0 = (CommonTree)adaptor.nil(); pushFollow(FOLLOW_method_def_in_expression210); method_def11=method_def(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, method_def11.getTree()); } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0); // depends on control dependency: [if], data = [none] adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); // depends on control dependency: [if], data = [none] } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } }
public class class_name { @Override public Number parse(String str, ParsePosition parsePosition) { Number result = null; if (str == null) { parsePosition.setIndex(-1); } else { str = str.trim(); if (str.length() == 0) { parsePosition.setIndex(-1); } else { result = super.parse(str, parsePosition); if (parsePosition.getIndex() == 0) { result = null; if (m_alternativeFormats != null) { for (int loop = 0; loop < m_alternativeFormats.length; loop++) { result = m_alternativeFormats[loop].parse(str, parsePosition); if (parsePosition.getIndex() != 0) { break; } } if (parsePosition.getIndex() == 0) { result = null; } } } } } return (result); } }
public class class_name { @Override public Number parse(String str, ParsePosition parsePosition) { Number result = null; if (str == null) { parsePosition.setIndex(-1); // depends on control dependency: [if], data = [none] } else { str = str.trim(); // depends on control dependency: [if], data = [none] if (str.length() == 0) { parsePosition.setIndex(-1); // depends on control dependency: [if], data = [none] } else { result = super.parse(str, parsePosition); // depends on control dependency: [if], data = [none] if (parsePosition.getIndex() == 0) { result = null; // depends on control dependency: [if], data = [none] if (m_alternativeFormats != null) { for (int loop = 0; loop < m_alternativeFormats.length; loop++) { result = m_alternativeFormats[loop].parse(str, parsePosition); // depends on control dependency: [for], data = [loop] if (parsePosition.getIndex() != 0) { break; } } if (parsePosition.getIndex() == 0) { result = null; // depends on control dependency: [if], data = [none] } } } } } return (result); } }
public class class_name { @Override public InetSocketAddress ipRemote() { SocketChannel s = _channel; if (s != null) { try { return (InetSocketAddress) s.getRemoteAddress(); } catch (IOException e) { return null; //throw new RuntimeException(e); } } else { return null; } } }
public class class_name { @Override public InetSocketAddress ipRemote() { SocketChannel s = _channel; if (s != null) { try { return (InetSocketAddress) s.getRemoteAddress(); // depends on control dependency: [try], data = [none] } catch (IOException e) { return null; //throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static BigRational valueOf(BigDecimal value) { if (value.compareTo(BigDecimal.ZERO) == 0) { return ZERO; } if (value.compareTo(BigDecimal.ONE) == 0) { return ONE; } int scale = value.scale(); if (scale == 0) { return new BigRational(value, BigDecimal.ONE); } else if (scale < 0) { BigDecimal n = new BigDecimal(value.unscaledValue()).multiply(BigDecimal.ONE.movePointLeft(value.scale())); return new BigRational(n, BigDecimal.ONE); } else { BigDecimal n = new BigDecimal(value.unscaledValue()); BigDecimal d = BigDecimal.ONE.movePointRight(value.scale()); return new BigRational(n, d); } } }
public class class_name { public static BigRational valueOf(BigDecimal value) { if (value.compareTo(BigDecimal.ZERO) == 0) { return ZERO; // depends on control dependency: [if], data = [none] } if (value.compareTo(BigDecimal.ONE) == 0) { return ONE; // depends on control dependency: [if], data = [none] } int scale = value.scale(); if (scale == 0) { return new BigRational(value, BigDecimal.ONE); // depends on control dependency: [if], data = [none] } else if (scale < 0) { BigDecimal n = new BigDecimal(value.unscaledValue()).multiply(BigDecimal.ONE.movePointLeft(value.scale())); return new BigRational(n, BigDecimal.ONE); // depends on control dependency: [if], data = [none] } else { BigDecimal n = new BigDecimal(value.unscaledValue()); BigDecimal d = BigDecimal.ONE.movePointRight(value.scale()); return new BigRational(n, d); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(RenewCertificateRequest renewCertificateRequest, ProtocolMarshaller protocolMarshaller) { if (renewCertificateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(renewCertificateRequest.getCertificateArn(), CERTIFICATEARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RenewCertificateRequest renewCertificateRequest, ProtocolMarshaller protocolMarshaller) { if (renewCertificateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(renewCertificateRequest.getCertificateArn(), CERTIFICATEARN_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 { private void sendSensorEvent(GVRPicker.GVRPickedObject collision, boolean over) { SensorEvent event = SensorEvent.obtain(); final IEventReceiver ownerCopy = getOwnerObject(); GVRCursorController controller; if (collision.picker == null) { collision.picker = mHit.picker; } else if (over) { mHit = collision; } controller = collision.picker.getController(); if (controller != null) { event.setCursorController(controller); } event.setActive(collision.touched); event.setPickedObject(collision); event.setOver(over); getGVRContext().getEventManager().sendEvent(ownerCopy, ISensorEvents.class, "onSensorEvent", event); event.recycle(); } }
public class class_name { private void sendSensorEvent(GVRPicker.GVRPickedObject collision, boolean over) { SensorEvent event = SensorEvent.obtain(); final IEventReceiver ownerCopy = getOwnerObject(); GVRCursorController controller; if (collision.picker == null) { collision.picker = mHit.picker; // depends on control dependency: [if], data = [none] } else if (over) { mHit = collision; // depends on control dependency: [if], data = [none] } controller = collision.picker.getController(); if (controller != null) { event.setCursorController(controller); // depends on control dependency: [if], data = [(controller] } event.setActive(collision.touched); event.setPickedObject(collision); event.setOver(over); getGVRContext().getEventManager().sendEvent(ownerCopy, ISensorEvents.class, "onSensorEvent", event); event.recycle(); } }
public class class_name { public Toolbox feature(Object... values) { if (values == null && values.length == 0) { return this; } if (this.feature == null) { this.feature = new LinkedHashMap<String, Feature>(); } for (Object t : values) { if (t instanceof Feature) { _addFeature((Feature) t); } else if (t instanceof Tool) { switch ((Tool) t) { case dataView: _addFeatureOnce(t, Feature.dataView); break; case dataZoom: _addFeatureOnce(t, Feature.dataZoom); break; case magicType: _addFeatureOnce(t, Feature.magicType); break; case mark: _addFeatureOnce(t, Feature.mark); break; case restore: _addFeatureOnce(t, Feature.restore); break; case saveAsImage: _addFeatureOnce(t, Feature.saveAsImage); break; default: //ignore } } } return this; } }
public class class_name { public Toolbox feature(Object... values) { if (values == null && values.length == 0) { return this; // depends on control dependency: [if], data = [none] } if (this.feature == null) { this.feature = new LinkedHashMap<String, Feature>(); // depends on control dependency: [if], data = [none] } for (Object t : values) { if (t instanceof Feature) { _addFeature((Feature) t); // depends on control dependency: [if], data = [none] } else if (t instanceof Tool) { switch ((Tool) t) { case dataView: _addFeatureOnce(t, Feature.dataView); break; case dataZoom: _addFeatureOnce(t, Feature.dataZoom); break; case magicType: _addFeatureOnce(t, Feature.magicType); break; case mark: _addFeatureOnce(t, Feature.mark); break; case restore: _addFeatureOnce(t, Feature.restore); break; case saveAsImage: _addFeatureOnce(t, Feature.saveAsImage); break; default: //ignore } } } return this; } }
public class class_name { protected final String getForFolSave(final Class<?> pClass) { if (PurchaseInvoiceServiceLine.class == pClass) { return PrcPurchaseInvoiceServiceLineSave.class.getSimpleName(); } else if (BankStatementLine.class == pClass) { return PrcBankStatementLineSave.class.getSimpleName(); } else if (SalesInvoiceServiceLine.class == pClass) { return PrcSalesInvoiceServiceLineSave.class.getSimpleName(); } else if (PurchaseReturnLine.class == pClass) { return PrcPurchaseReturnLineSave.class.getSimpleName(); } else if (WageTaxLine.class == pClass) { return PrcWageTaxLineSave.class.getSimpleName(); } else if (InvItemTaxCategoryLine.class == pClass) { return PrcInvItemTaxCategoryLineSave.class.getSimpleName(); } else if (AdditionCostLine.class == pClass) { return PrcAdditionCostLineSave.class.getSimpleName(); } else if (WageLine.class == pClass) { return PrcWageLineSave.class.getSimpleName(); } else if (SalesReturnLine.class == pClass) { return PrcSalesReturnLineSave.class.getSimpleName(); } else if (MoveItemsLine.class == pClass) { return PrcMoveItemsLineSave.class.getSimpleName(); } else if (UsedMaterialLine.class == pClass) { return PrcUsedMaterialLineSave.class.getSimpleName(); } else if (AccountingEntry.class == pClass) { return PrcAccEntrySave.class.getSimpleName(); } else if (GoodsLossLine.class == pClass) { return PrcGoodsLossLineSave.class.getSimpleName(); } else if (SalesInvoiceLine.class == pClass) { return PrcSalesInvoiceLineSave.class.getSimpleName(); } else if (BeginningInventoryLine.class == pClass) { return PrcBeginningInventoryLineSave.class.getSimpleName(); } else if (PurchaseInvoiceLine.class == pClass) { return PrcPurchaseInvoiceLineSave.class.getSimpleName(); } else if (Eattachment.class == pClass) { return PrcEntityFfolSave.class.getSimpleName(); } else if (ADocTaxLine.class.isAssignableFrom(pClass)) { if (PurchaseInvoiceTaxLine.class == pClass) { return PrcInvTaxLnSave.class.getSimpleName() + "PITL"; } else if (SalesReturnTaxLine.class == pClass) { return PrcInvTaxLnSave.class.getSimpleName() + "SRTL"; } else if (SalesInvoiceTaxLine.class == pClass) { return PrcInvTaxLnSave.class.getSimpleName() + "SITL"; } else if (PurchaseReturnTaxLine.class == pClass) { return PrcPurRetTaxLnSave.class.getSimpleName(); } else { return null; } } else if (AReplExcludeAccountsDebitCredit.class .isAssignableFrom(pClass)) { return PrcReplExcludeAccountsDebitCreditSave.class.getSimpleName(); } else if (AccEntriesSourcesLine.class == pClass || ADrawItemSourcesLine.class.isAssignableFrom(pClass)) { return PrcAccSettingsLineSave.class.getSimpleName(); } else { if (this.hldAddEntitiesProcessorNames != null) { String name = this.hldAddEntitiesProcessorNames .getForFolSave(pClass); if (name != null) { return name; } } return PrcEntityFolSave.class.getSimpleName(); } } }
public class class_name { protected final String getForFolSave(final Class<?> pClass) { if (PurchaseInvoiceServiceLine.class == pClass) { return PrcPurchaseInvoiceServiceLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (BankStatementLine.class == pClass) { return PrcBankStatementLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (SalesInvoiceServiceLine.class == pClass) { return PrcSalesInvoiceServiceLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (PurchaseReturnLine.class == pClass) { return PrcPurchaseReturnLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (WageTaxLine.class == pClass) { return PrcWageTaxLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (InvItemTaxCategoryLine.class == pClass) { return PrcInvItemTaxCategoryLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (AdditionCostLine.class == pClass) { return PrcAdditionCostLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (WageLine.class == pClass) { return PrcWageLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (SalesReturnLine.class == pClass) { return PrcSalesReturnLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (MoveItemsLine.class == pClass) { return PrcMoveItemsLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (UsedMaterialLine.class == pClass) { return PrcUsedMaterialLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (AccountingEntry.class == pClass) { return PrcAccEntrySave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (GoodsLossLine.class == pClass) { return PrcGoodsLossLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (SalesInvoiceLine.class == pClass) { return PrcSalesInvoiceLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (BeginningInventoryLine.class == pClass) { return PrcBeginningInventoryLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (PurchaseInvoiceLine.class == pClass) { return PrcPurchaseInvoiceLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (Eattachment.class == pClass) { return PrcEntityFfolSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (ADocTaxLine.class.isAssignableFrom(pClass)) { if (PurchaseInvoiceTaxLine.class == pClass) { return PrcInvTaxLnSave.class.getSimpleName() + "PITL"; // depends on control dependency: [if], data = [none] } else if (SalesReturnTaxLine.class == pClass) { return PrcInvTaxLnSave.class.getSimpleName() + "SRTL"; // depends on control dependency: [if], data = [none] } else if (SalesInvoiceTaxLine.class == pClass) { return PrcInvTaxLnSave.class.getSimpleName() + "SITL"; // depends on control dependency: [if], data = [none] } else if (PurchaseReturnTaxLine.class == pClass) { return PrcPurRetTaxLnSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } else if (AReplExcludeAccountsDebitCredit.class .isAssignableFrom(pClass)) { return PrcReplExcludeAccountsDebitCreditSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if (AccEntriesSourcesLine.class == pClass || ADrawItemSourcesLine.class.isAssignableFrom(pClass)) { return PrcAccSettingsLineSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else { if (this.hldAddEntitiesProcessorNames != null) { String name = this.hldAddEntitiesProcessorNames .getForFolSave(pClass); if (name != null) { return name; // depends on control dependency: [if], data = [none] } } return PrcEntityFolSave.class.getSimpleName(); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public double dot(Vec v) { if(v instanceof ShiftedVec) { ShiftedVec other = (ShiftedVec) v; return this.base.dot(other.base) + other.base.sum()*this.shift + this.base.sum()*other.shift + this.length()*this.shift*other.shift; } return base.dot(v) + v.sum()*shift; } }
public class class_name { @Override public double dot(Vec v) { if(v instanceof ShiftedVec) { ShiftedVec other = (ShiftedVec) v; return this.base.dot(other.base) + other.base.sum()*this.shift + this.base.sum()*other.shift + this.length()*this.shift*other.shift; // depends on control dependency: [if], data = [none] } return base.dot(v) + v.sum()*shift; } }
public class class_name { public static String format(String[] d, String sep) { if(d == null) { return "null"; } if(d.length == 0) { return ""; } if(d.length == 1) { return d[0]; } int len = sep.length() * (d.length - 1); for(String s : d) { len += s.length(); } StringBuilder buffer = new StringBuilder(len)// .append(d[0]); for(int i = 1; i < d.length; i++) { buffer.append(sep).append(d[i]); } return buffer.toString(); } }
public class class_name { public static String format(String[] d, String sep) { if(d == null) { return "null"; // depends on control dependency: [if], data = [none] } if(d.length == 0) { return ""; // depends on control dependency: [if], data = [none] } if(d.length == 1) { return d[0]; // depends on control dependency: [if], data = [none] } int len = sep.length() * (d.length - 1); for(String s : d) { len += s.length(); // depends on control dependency: [for], data = [s] } StringBuilder buffer = new StringBuilder(len)// .append(d[0]); for(int i = 1; i < d.length; i++) { buffer.append(sep).append(d[i]); // depends on control dependency: [for], data = [i] } return buffer.toString(); } }
public class class_name { private synchronized byte[] getPseudoIEEE802MACAddress(long uniqueTimeStamp) { byte[] ieee802Addr = new byte[6]; byte[] currentTime = String.valueOf(uniqueTimeStamp).getBytes(); byte[] localHostAddress = null; try { localHostAddress = InetAddress.getLocalHost().getAddress(); } catch (UnknownHostException u) { localHostAddress = new byte[] { 127, 0, 0, 1 }; } //Use the unsigned hexadecimal representation of the hash code of the object instead //of the java.lang.Object#toString() to eliminate the 'java.lang.Object@' prefix //(see java.lang.Object#toString()) which never changes: byte[] inMemoryObject = Integer.toHexString(new Object().hashCode()).getBytes(); byte[] freeMemory = String.valueOf(Runtime.getRuntime().freeMemory()).getBytes(); byte[] totalMemory = String.valueOf(Runtime.getRuntime().totalMemory()).getBytes(); byte[] messageDigestInput = new byte[currentTime.length + localHostAddress.length + inMemoryObject.length + freeMemory.length + totalMemory.length]; int messageDigestInputIndex = 0; System.arraycopy(currentTime, 0, messageDigestInput, messageDigestInputIndex, currentTime.length); messageDigestInputIndex += currentTime.length; System.arraycopy(localHostAddress, 0, messageDigestInput, messageDigestInputIndex, localHostAddress.length); messageDigestInputIndex += localHostAddress.length; System.arraycopy(inMemoryObject, 0, messageDigestInput, messageDigestInputIndex, inMemoryObject.length); messageDigestInputIndex += inMemoryObject.length; System.arraycopy(freeMemory, 0, messageDigestInput, messageDigestInputIndex, freeMemory.length); messageDigestInputIndex += freeMemory.length; System.arraycopy(totalMemory, 0, messageDigestInput, messageDigestInputIndex, totalMemory.length); try { //Compute the message digest: MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.reset(); System.arraycopy(md5.digest(messageDigestInput), 0, ieee802Addr, 0, 6); } catch (Throwable t) { //If a provider for the MD5 hash algorithm (see Java Cryptography Architecture (JCA) APIs) //is not available in the run-time environment, a simple additive hash algorithm is used over the random //data. The simple additive hash algorithm is similar to that used in java.lang.String#hashCode(). //That is: // b[0]*31^(n-1) + b[1]*31^(n-2) + ... + b[n-1] //where: // b[i] = i-th byte // n = total number of bytes // ^ = exponentiation //Note: It is computationally feasible for this simple additive hash algorithm to generate the same output //for two different inputs. int hashCode = 0; for (int counter = 0; counter < messageDigestInput.length; counter++) { hashCode = (31 * hashCode) + messageDigestInput[counter]; } byte[] hashCodeBytes = Integer.toHexString(hashCode).getBytes(); //Zero pad the hash code if less than 6 bytes: if (hashCodeBytes.length < 6) { System.arraycopy(hashCodeBytes, 0, ieee802Addr, (6 - hashCodeBytes.length), hashCodeBytes.length); } //Use the last 6 bytes of the hash code which contains the most varying data and : else { System.arraycopy(hashCodeBytes, (hashCodeBytes.length - 6), ieee802Addr, 0, 6); } } //Turn on the high order bit of the first byte: ieee802Addr[0] |= 0x80; return ieee802Addr; } }
public class class_name { private synchronized byte[] getPseudoIEEE802MACAddress(long uniqueTimeStamp) { byte[] ieee802Addr = new byte[6]; byte[] currentTime = String.valueOf(uniqueTimeStamp).getBytes(); byte[] localHostAddress = null; try { localHostAddress = InetAddress.getLocalHost().getAddress(); // depends on control dependency: [try], data = [none] } catch (UnknownHostException u) { localHostAddress = new byte[] { 127, 0, 0, 1 }; } // depends on control dependency: [catch], data = [none] //Use the unsigned hexadecimal representation of the hash code of the object instead //of the java.lang.Object#toString() to eliminate the 'java.lang.Object@' prefix //(see java.lang.Object#toString()) which never changes: byte[] inMemoryObject = Integer.toHexString(new Object().hashCode()).getBytes(); byte[] freeMemory = String.valueOf(Runtime.getRuntime().freeMemory()).getBytes(); byte[] totalMemory = String.valueOf(Runtime.getRuntime().totalMemory()).getBytes(); byte[] messageDigestInput = new byte[currentTime.length + localHostAddress.length + inMemoryObject.length + freeMemory.length + totalMemory.length]; int messageDigestInputIndex = 0; System.arraycopy(currentTime, 0, messageDigestInput, messageDigestInputIndex, currentTime.length); messageDigestInputIndex += currentTime.length; System.arraycopy(localHostAddress, 0, messageDigestInput, messageDigestInputIndex, localHostAddress.length); messageDigestInputIndex += localHostAddress.length; System.arraycopy(inMemoryObject, 0, messageDigestInput, messageDigestInputIndex, inMemoryObject.length); messageDigestInputIndex += inMemoryObject.length; System.arraycopy(freeMemory, 0, messageDigestInput, messageDigestInputIndex, freeMemory.length); messageDigestInputIndex += freeMemory.length; System.arraycopy(totalMemory, 0, messageDigestInput, messageDigestInputIndex, totalMemory.length); try { //Compute the message digest: MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.reset(); // depends on control dependency: [try], data = [none] System.arraycopy(md5.digest(messageDigestInput), 0, ieee802Addr, 0, 6); // depends on control dependency: [try], data = [none] } catch (Throwable t) { //If a provider for the MD5 hash algorithm (see Java Cryptography Architecture (JCA) APIs) //is not available in the run-time environment, a simple additive hash algorithm is used over the random //data. The simple additive hash algorithm is similar to that used in java.lang.String#hashCode(). //That is: // b[0]*31^(n-1) + b[1]*31^(n-2) + ... + b[n-1] //where: // b[i] = i-th byte // n = total number of bytes // ^ = exponentiation //Note: It is computationally feasible for this simple additive hash algorithm to generate the same output //for two different inputs. int hashCode = 0; for (int counter = 0; counter < messageDigestInput.length; counter++) { hashCode = (31 * hashCode) + messageDigestInput[counter]; // depends on control dependency: [for], data = [counter] } byte[] hashCodeBytes = Integer.toHexString(hashCode).getBytes(); //Zero pad the hash code if less than 6 bytes: if (hashCodeBytes.length < 6) { System.arraycopy(hashCodeBytes, 0, ieee802Addr, (6 - hashCodeBytes.length), hashCodeBytes.length); // depends on control dependency: [if], data = [none] } //Use the last 6 bytes of the hash code which contains the most varying data and : else { System.arraycopy(hashCodeBytes, (hashCodeBytes.length - 6), ieee802Addr, 0, 6); // depends on control dependency: [if], data = [(hashCodeBytes.length] } } // depends on control dependency: [catch], data = [none] //Turn on the high order bit of the first byte: ieee802Addr[0] |= 0x80; return ieee802Addr; } }
public class class_name { public List<TagCount> getTagsOnSpace(int spaceId, int limit, String text) { MultivaluedMap<String, String> params=new MultivaluedMapImpl(); params.add("limit", new Integer(limit).toString()); if ((text != null) && (!text.isEmpty())) { params.add("text", text); } return getTagsOnSpace(spaceId, params); } }
public class class_name { public List<TagCount> getTagsOnSpace(int spaceId, int limit, String text) { MultivaluedMap<String, String> params=new MultivaluedMapImpl(); params.add("limit", new Integer(limit).toString()); if ((text != null) && (!text.isEmpty())) { params.add("text", text); // depends on control dependency: [if], data = [none] } return getTagsOnSpace(spaceId, params); } }
public class class_name { public static IDifference difference(IChemObject first, IChemObject second) { if (!(first instanceof IIsotope && second instanceof IIsotope)) { return null; } IIsotope firstElem = (IIsotope) first; IIsotope secondElem = (IIsotope) second; ChemObjectDifference totalDiff = new ChemObjectDifference("IsotopeDiff"); totalDiff.addChild(IntegerDifference.construct("MN", firstElem.getMassNumber(), secondElem.getMassNumber())); totalDiff.addChild(DoubleDifference.construct("EM", firstElem.getExactMass(), secondElem.getExactMass())); totalDiff.addChild(DoubleDifference.construct("AB", firstElem.getNaturalAbundance(), secondElem.getNaturalAbundance())); totalDiff.addChild(ElementDiff.difference(first, second)); if (totalDiff.childCount() > 0) { return totalDiff; } else { return null; } } }
public class class_name { public static IDifference difference(IChemObject first, IChemObject second) { if (!(first instanceof IIsotope && second instanceof IIsotope)) { return null; // depends on control dependency: [if], data = [none] } IIsotope firstElem = (IIsotope) first; IIsotope secondElem = (IIsotope) second; ChemObjectDifference totalDiff = new ChemObjectDifference("IsotopeDiff"); totalDiff.addChild(IntegerDifference.construct("MN", firstElem.getMassNumber(), secondElem.getMassNumber())); totalDiff.addChild(DoubleDifference.construct("EM", firstElem.getExactMass(), secondElem.getExactMass())); totalDiff.addChild(DoubleDifference.construct("AB", firstElem.getNaturalAbundance(), secondElem.getNaturalAbundance())); totalDiff.addChild(ElementDiff.difference(first, second)); if (totalDiff.childCount() > 0) { return totalDiff; // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean edgeCaseQueryNoFixNeeded(Set<String> mvDDLGroupbyColumnNames, Map<String, ExpressionType> mvColumnAggType, List<ParsedColInfo> displayColumns, List<ParsedColInfo> groupByColumns) { // Condition (1): Group by columns must be part of or all from MV DDL group by TVEs. for (ParsedColInfo gcol: groupByColumns) { assert(gcol.m_expression instanceof TupleValueExpression); TupleValueExpression tve = (TupleValueExpression) gcol.m_expression; if (tve.getTableName().equals(getMVTableName()) && ! mvDDLGroupbyColumnNames.contains(tve.getColumnName())) { return false; } } // Condition (2): All the aggregations must qualify. for (ParsedColInfo dcol: displayColumns) { if (groupByColumns.contains(dcol)) { // Skip a group-by column pass-through. continue; } if (dcol.m_expression instanceof AggregateExpression == false) { return false; } AggregateExpression aggExpr = (AggregateExpression) dcol.m_expression; if (aggExpr.getLeft() instanceof TupleValueExpression == false) { return false; } ExpressionType type = aggExpr.getExpressionType(); // Only MIN, MAX, and non-DISTINCT SUM // can tolerate a skipped reaggregation. if ((type != ExpressionType.AGGREGATE_SUM || aggExpr.isDistinct()) && type != ExpressionType.AGGREGATE_MIN && type != ExpressionType.AGGREGATE_MAX) { return false; } TupleValueExpression tve = (TupleValueExpression) aggExpr.getLeft(); if (tve.getTableName().equals(getMVTableName())) { String columnName = tve.getColumnName(); // The type of the aggregation in the query must match the // type of aggregation defined for the view column -- // SUMming a SUM, MINning a MIN, or MAXxing a MAX. if (mvColumnAggType.get(columnName) != type ) { return false; } } else { // The aggregate argument is a column from the // other (non-view) side of the join. // It's OK for its rows to get duplicated by joining // with multiple "partial group" rows ONLY if it is // feeding a MIN or MAX. // The duplication would corrupt a SUM. if (type == ExpressionType.AGGREGATE_SUM) { return false; } } } // Edge case query can be optimized with correct answer without MV reAggregation fix. return true; } }
public class class_name { private boolean edgeCaseQueryNoFixNeeded(Set<String> mvDDLGroupbyColumnNames, Map<String, ExpressionType> mvColumnAggType, List<ParsedColInfo> displayColumns, List<ParsedColInfo> groupByColumns) { // Condition (1): Group by columns must be part of or all from MV DDL group by TVEs. for (ParsedColInfo gcol: groupByColumns) { assert(gcol.m_expression instanceof TupleValueExpression); // depends on control dependency: [for], data = [gcol] TupleValueExpression tve = (TupleValueExpression) gcol.m_expression; if (tve.getTableName().equals(getMVTableName()) && ! mvDDLGroupbyColumnNames.contains(tve.getColumnName())) { return false; // depends on control dependency: [if], data = [none] } } // Condition (2): All the aggregations must qualify. for (ParsedColInfo dcol: displayColumns) { if (groupByColumns.contains(dcol)) { // Skip a group-by column pass-through. continue; } if (dcol.m_expression instanceof AggregateExpression == false) { return false; // depends on control dependency: [if], data = [none] } AggregateExpression aggExpr = (AggregateExpression) dcol.m_expression; if (aggExpr.getLeft() instanceof TupleValueExpression == false) { return false; // depends on control dependency: [if], data = [none] } ExpressionType type = aggExpr.getExpressionType(); // Only MIN, MAX, and non-DISTINCT SUM // can tolerate a skipped reaggregation. if ((type != ExpressionType.AGGREGATE_SUM || aggExpr.isDistinct()) && type != ExpressionType.AGGREGATE_MIN && type != ExpressionType.AGGREGATE_MAX) { return false; // depends on control dependency: [if], data = [none] } TupleValueExpression tve = (TupleValueExpression) aggExpr.getLeft(); if (tve.getTableName().equals(getMVTableName())) { String columnName = tve.getColumnName(); // The type of the aggregation in the query must match the // type of aggregation defined for the view column -- // SUMming a SUM, MINning a MIN, or MAXxing a MAX. if (mvColumnAggType.get(columnName) != type ) { return false; // depends on control dependency: [if], data = [none] } } else { // The aggregate argument is a column from the // other (non-view) side of the join. // It's OK for its rows to get duplicated by joining // with multiple "partial group" rows ONLY if it is // feeding a MIN or MAX. // The duplication would corrupt a SUM. if (type == ExpressionType.AGGREGATE_SUM) { return false; // depends on control dependency: [if], data = [none] } } } // Edge case query can be optimized with correct answer without MV reAggregation fix. return true; } }
public class class_name { public Date getObjectLockRetainUntilDate() { String dateStr = (String) metadata.get(Headers.OBJECT_LOCK_RETAIN_UNTIL_DATE); if (dateStr != null) { return DateUtils.parseISO8601Date(dateStr); } return null; } }
public class class_name { public Date getObjectLockRetainUntilDate() { String dateStr = (String) metadata.get(Headers.OBJECT_LOCK_RETAIN_UNTIL_DATE); if (dateStr != null) { return DateUtils.parseISO8601Date(dateStr); // depends on control dependency: [if], data = [(dateStr] } return null; } }
public class class_name { public List<D6TableMetaInfo> getTablesInfo(DBConnInfo dbConnInfo) { final List<D6TableMetaInfo> retTablesInfo = new ArrayList<D6TableMetaInfo>(); final Connection conn = new DBConnCreator(dbConnInfo).createDBConnection(); final List<String> tableList = new ArrayList<String>(); ResultSet rs = null; try { final DatabaseMetaData metaData = conn.getMetaData(); rs = metaData.getTables(null, null, "%", new String[] { "TABLE" }); try { while (rs.next()) { final String tableName = rs.getString("TABLE_NAME"); tableList.add(tableName); } } finally { rs.close(); } for (String tableName : tableList) { final D6TableMetaInfo tableInfo = new D6TableMetaInfo(); tableInfo.tableName = tableName; final Map<String, D6ColumnMetaInfo> colInfoMap = new LinkedHashMap<String, D6ColumnMetaInfo>(); rs = metaData.getColumns(null, null, tableName, null); try { while (rs.next()) { D6ColumnMetaInfo colMeta = new D6ColumnMetaInfo(); colMeta.columnName = rs.getString("COLUMN_NAME"); colMeta.typeName = rs.getString("TYPE_NAME"); colMeta.columnSize = rs.getInt("COLUMN_SIZE"); colMeta.isNullable = "YES".equals(rs.getString("IS_NULLABLE")); colMeta.isAutoIncrement = "YES".equals("IS_AUTOINCREMENT"); // java.sql.Types colMeta.dataType = rs.getInt("DATA_TYPE"); colInfoMap.put(colMeta.columnName, colMeta); } } finally { rs.close(); } rs = metaData.getPrimaryKeys(null, null, tableName); try { while (rs.next()) { final String columnName = rs.getString("COLUMN_NAME"); final String pkName = rs.getString("PK_NAME"); final short primaryKeySequentialIndex = rs.getShort("KEY_SEQ"); final D6ColumnMetaInfo colMeta = colInfoMap.get(columnName); if (colMeta != null) { colMeta.pkName = pkName; colMeta.isPrimaryKey = true; colMeta.primaryKeySeqNum = primaryKeySequentialIndex; } } } finally { rs.close(); } final Statement stmt = conn.createStatement(); try { rs = stmt.executeQuery("SELECT * FROM " + tableName + " WHERE 0=1"); try { ResultSetMetaData rmd = rs.getMetaData(); for (int i = 1; i <= rmd.getColumnCount(); i++) { String columnName = rmd.getColumnName(i); final D6ColumnMetaInfo colMeta = colInfoMap.get(columnName); if (colMeta != null) { colMeta.className = rmd.getColumnClassName(i); } } } finally { rs.close(); } } finally { stmt.close(); } for (String columnName : colInfoMap.keySet()) { D6ColumnMetaInfo colMeta = colInfoMap.get(columnName); tableInfo.columnList.add(colMeta); } retTablesInfo.add(tableInfo); } } catch (SQLException e) { e.printStackTrace(); } finally { try { conn.close(); } catch (SQLException e) { } } return retTablesInfo; } }
public class class_name { public List<D6TableMetaInfo> getTablesInfo(DBConnInfo dbConnInfo) { final List<D6TableMetaInfo> retTablesInfo = new ArrayList<D6TableMetaInfo>(); final Connection conn = new DBConnCreator(dbConnInfo).createDBConnection(); final List<String> tableList = new ArrayList<String>(); ResultSet rs = null; try { final DatabaseMetaData metaData = conn.getMetaData(); rs = metaData.getTables(null, null, "%", new String[] { "TABLE" }); // depends on control dependency: [try], data = [none] try { while (rs.next()) { final String tableName = rs.getString("TABLE_NAME"); tableList.add(tableName); // depends on control dependency: [while], data = [none] } } finally { rs.close(); } for (String tableName : tableList) { final D6TableMetaInfo tableInfo = new D6TableMetaInfo(); tableInfo.tableName = tableName; // depends on control dependency: [for], data = [tableName] final Map<String, D6ColumnMetaInfo> colInfoMap = new LinkedHashMap<String, D6ColumnMetaInfo>(); rs = metaData.getColumns(null, null, tableName, null); // depends on control dependency: [for], data = [tableName] try { while (rs.next()) { D6ColumnMetaInfo colMeta = new D6ColumnMetaInfo(); colMeta.columnName = rs.getString("COLUMN_NAME"); // depends on control dependency: [while], data = [none] colMeta.typeName = rs.getString("TYPE_NAME"); // depends on control dependency: [while], data = [none] colMeta.columnSize = rs.getInt("COLUMN_SIZE"); // depends on control dependency: [while], data = [none] colMeta.isNullable = "YES".equals(rs.getString("IS_NULLABLE")); // depends on control dependency: [while], data = [none] colMeta.isAutoIncrement = "YES".equals("IS_AUTOINCREMENT"); // depends on control dependency: [while], data = [none] // java.sql.Types colMeta.dataType = rs.getInt("DATA_TYPE"); // depends on control dependency: [while], data = [none] colInfoMap.put(colMeta.columnName, colMeta); // depends on control dependency: [while], data = [none] } } finally { rs.close(); } rs = metaData.getPrimaryKeys(null, null, tableName); // depends on control dependency: [for], data = [tableName] try { while (rs.next()) { final String columnName = rs.getString("COLUMN_NAME"); final String pkName = rs.getString("PK_NAME"); final short primaryKeySequentialIndex = rs.getShort("KEY_SEQ"); final D6ColumnMetaInfo colMeta = colInfoMap.get(columnName); if (colMeta != null) { colMeta.pkName = pkName; // depends on control dependency: [if], data = [none] colMeta.isPrimaryKey = true; // depends on control dependency: [if], data = [none] colMeta.primaryKeySeqNum = primaryKeySequentialIndex; // depends on control dependency: [if], data = [none] } } } finally { rs.close(); } final Statement stmt = conn.createStatement(); try { rs = stmt.executeQuery("SELECT * FROM " + tableName + " WHERE 0=1"); // depends on control dependency: [try], data = [none] try { ResultSetMetaData rmd = rs.getMetaData(); for (int i = 1; i <= rmd.getColumnCount(); i++) { String columnName = rmd.getColumnName(i); final D6ColumnMetaInfo colMeta = colInfoMap.get(columnName); if (colMeta != null) { colMeta.className = rmd.getColumnClassName(i); // depends on control dependency: [if], data = [none] } } } finally { rs.close(); } } finally { stmt.close(); } for (String columnName : colInfoMap.keySet()) { D6ColumnMetaInfo colMeta = colInfoMap.get(columnName); tableInfo.columnList.add(colMeta); // depends on control dependency: [for], data = [none] } retTablesInfo.add(tableInfo); // depends on control dependency: [for], data = [none] } } catch (SQLException e) { e.printStackTrace(); } finally { // depends on control dependency: [catch], data = [none] try { conn.close(); // depends on control dependency: [try], data = [none] } catch (SQLException e) { } // depends on control dependency: [catch], data = [none] } return retTablesInfo; } }
public class class_name { public synchronized Boolean start() { if (started) { return true; } createSerialPort(); serialPort.addEventListener(this); if (!serialPort.connect()) { log.error("Failed to start Firmata Library. Cannot connect to Serial Port."); log.error("Configuration is {}", configuration); stop(); return false; } if (configuration.getTestProtocolCommunication()) { if (!testProtocolCommunication()) { stop(); return false; } } started = true; return true; } }
public class class_name { public synchronized Boolean start() { if (started) { return true; // depends on control dependency: [if], data = [none] } createSerialPort(); serialPort.addEventListener(this); if (!serialPort.connect()) { log.error("Failed to start Firmata Library. Cannot connect to Serial Port."); // depends on control dependency: [if], data = [none] log.error("Configuration is {}", configuration); // depends on control dependency: [if], data = [none] stop(); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } if (configuration.getTestProtocolCommunication()) { if (!testProtocolCommunication()) { stop(); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } started = true; return true; } }
public class class_name { public EClass getIfcFlowTreatmentDeviceType() { if (ifcFlowTreatmentDeviceTypeEClass == null) { ifcFlowTreatmentDeviceTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(255); } return ifcFlowTreatmentDeviceTypeEClass; } }
public class class_name { public EClass getIfcFlowTreatmentDeviceType() { if (ifcFlowTreatmentDeviceTypeEClass == null) { ifcFlowTreatmentDeviceTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(255); // depends on control dependency: [if], data = [none] } return ifcFlowTreatmentDeviceTypeEClass; } }
public class class_name { private void configureClearText(final SocketChannel ch) { final ChannelPipeline p = ch.pipeline(); final HttpServerCodec sourceCodec = new HttpServerCodec(); final HttpServerUpgradeHandler upgradeHandler = new HttpServerUpgradeHandler(sourceCodec, new UpgradeCodecFactory() { @Override public HttpServerUpgradeHandler.UpgradeCodec newUpgradeCodec(CharSequence protocol) { if (AsciiString.contentEquals(Http2CodecUtil.HTTP_UPGRADE_PROTOCOL_NAME, protocol)) { return new Http2ServerUpgradeCodec(new Http2ChannelHandlerBuilder(serverHandler).build()); } else { return null; } } }); final Http2ServerUpgradeHandler cleartextHttp2ServerUpgradeHandler = new Http2ServerUpgradeHandler(bizGroup, sourceCodec, upgradeHandler, new Http2ChannelHandlerBuilder(serverHandler).build()); // 先通过 HTTP Upgrade 协商版本 p.addLast("Http2ServerUpgradeHandler", cleartextHttp2ServerUpgradeHandler); // 如果没有升级,那就是HTTP/1.1的请求,降级 p.addLast("HttpDirectTalkingHandler", new SimpleChannelInboundHandler<HttpMessage>() { @Override protected void channelRead0(ChannelHandlerContext ctx, HttpMessage msg) throws Exception { // If this handler is hit then no upgrade has been attempted and the client is just talking HTTP. if (LOGGER.isWarnEnabled()) { LOGGER.warn("Directly talking: {} (no upgrade was attempted) from {}", msg.protocolVersion(), NetUtil.toSocketAddressString(ch.remoteAddress())); } ChannelPipeline pipeline = ctx.pipeline(); ChannelHandlerContext thisCtx = pipeline.context(this); // 不需要了 pipeline.addAfter(bizGroup, thisCtx.name(), "Http1ChannelHandler", new Http1ServerChannelHandler(serverHandler)); pipeline.replace(this, "HttpObjectAggregator", new HttpObjectAggregator(maxHttpContentLength)); // HttpServerUpgradeHandler -> HttpServerCodec -> HttpObjectAggregator -> Http1ChannelHandler, ctx.fireChannelRead(ReferenceCountUtil.retain(msg)); } }); } }
public class class_name { private void configureClearText(final SocketChannel ch) { final ChannelPipeline p = ch.pipeline(); final HttpServerCodec sourceCodec = new HttpServerCodec(); final HttpServerUpgradeHandler upgradeHandler = new HttpServerUpgradeHandler(sourceCodec, new UpgradeCodecFactory() { @Override public HttpServerUpgradeHandler.UpgradeCodec newUpgradeCodec(CharSequence protocol) { if (AsciiString.contentEquals(Http2CodecUtil.HTTP_UPGRADE_PROTOCOL_NAME, protocol)) { return new Http2ServerUpgradeCodec(new Http2ChannelHandlerBuilder(serverHandler).build()); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }); final Http2ServerUpgradeHandler cleartextHttp2ServerUpgradeHandler = new Http2ServerUpgradeHandler(bizGroup, sourceCodec, upgradeHandler, new Http2ChannelHandlerBuilder(serverHandler).build()); // 先通过 HTTP Upgrade 协商版本 p.addLast("Http2ServerUpgradeHandler", cleartextHttp2ServerUpgradeHandler); // 如果没有升级,那就是HTTP/1.1的请求,降级 p.addLast("HttpDirectTalkingHandler", new SimpleChannelInboundHandler<HttpMessage>() { @Override protected void channelRead0(ChannelHandlerContext ctx, HttpMessage msg) throws Exception { // If this handler is hit then no upgrade has been attempted and the client is just talking HTTP. if (LOGGER.isWarnEnabled()) { LOGGER.warn("Directly talking: {} (no upgrade was attempted) from {}", msg.protocolVersion(), NetUtil.toSocketAddressString(ch.remoteAddress())); } ChannelPipeline pipeline = ctx.pipeline(); ChannelHandlerContext thisCtx = pipeline.context(this); // 不需要了 pipeline.addAfter(bizGroup, thisCtx.name(), "Http1ChannelHandler", new Http1ServerChannelHandler(serverHandler)); pipeline.replace(this, "HttpObjectAggregator", new HttpObjectAggregator(maxHttpContentLength)); // HttpServerUpgradeHandler -> HttpServerCodec -> HttpObjectAggregator -> Http1ChannelHandler, ctx.fireChannelRead(ReferenceCountUtil.retain(msg)); } }); } }
public class class_name { private void register(PathMapping pathMapping) throws IOException { GeneratorRegistry generatorRegistry = bundlesHandler.getConfig().getGeneratorRegistry(); List<PathMapping> mappings = new ArrayList<>(); if (generatorRegistry.isPathGenerated(pathMapping.getPath())) { List<PathMapping> genPathMappings = generatorRegistry.getGeneratedPathMappings(pathMapping.getBundle(), pathMapping.getPath(), rsReader); if (genPathMappings != null) { mappings.addAll(genPathMappings); } else { mappings.add(pathMapping); } } else { mappings.add(pathMapping); } for (PathMapping pMapping : mappings) { String filePath = rsReader.getFilePath(pMapping.getPath()); registerPathMapping(pMapping, filePath); } } }
public class class_name { private void register(PathMapping pathMapping) throws IOException { GeneratorRegistry generatorRegistry = bundlesHandler.getConfig().getGeneratorRegistry(); List<PathMapping> mappings = new ArrayList<>(); if (generatorRegistry.isPathGenerated(pathMapping.getPath())) { List<PathMapping> genPathMappings = generatorRegistry.getGeneratedPathMappings(pathMapping.getBundle(), pathMapping.getPath(), rsReader); if (genPathMappings != null) { mappings.addAll(genPathMappings); // depends on control dependency: [if], data = [(genPathMappings] } else { mappings.add(pathMapping); // depends on control dependency: [if], data = [none] } } else { mappings.add(pathMapping); } for (PathMapping pMapping : mappings) { String filePath = rsReader.getFilePath(pMapping.getPath()); registerPathMapping(pMapping, filePath); } } }
public class class_name { @Override public void handleAsyncException(String message, Throwable exception) { if (isRunning) { // only fail if the task is still running getEnvironment().failExternally(exception); } } }
public class class_name { @Override public void handleAsyncException(String message, Throwable exception) { if (isRunning) { // only fail if the task is still running getEnvironment().failExternally(exception); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void slmexpire(final String keyspace, final String uid, final long expireMillis, final String serviceCode, final String... keys) { final byte[][] bkeys = new byte[keys.length][]; for (int i = 0; i < keys.length; i++) { bkeys[i] = SafeEncoder.encode(keys[i]); } slmexpire(SafeEncoder.encode(keyspace), SafeEncoder.encode(uid), expireMillis, SafeEncoder.encode(serviceCode), bkeys); } }
public class class_name { public void slmexpire(final String keyspace, final String uid, final long expireMillis, final String serviceCode, final String... keys) { final byte[][] bkeys = new byte[keys.length][]; for (int i = 0; i < keys.length; i++) { bkeys[i] = SafeEncoder.encode(keys[i]); // depends on control dependency: [for], data = [i] } slmexpire(SafeEncoder.encode(keyspace), SafeEncoder.encode(uid), expireMillis, SafeEncoder.encode(serviceCode), bkeys); } }
public class class_name { public static Annotation[] union(Annotation[] a, Annotation[] b) { // fast path if (a.length==0) return b; if (b.length==0) return a; // slow path List<Annotation> combined = new ArrayList<Annotation>(a.length+b.length); combined.addAll(Arrays.asList(a)); OUTER: for (Annotation x : b) { for (int i=0; i<a.length; i++) { if (x.annotationType()==combined.get(i).annotationType()) { combined.set(i,x); // override continue OUTER; } } // not overlapping. append combined.add(x); } return combined.toArray(new Annotation[combined.size()]); } }
public class class_name { public static Annotation[] union(Annotation[] a, Annotation[] b) { // fast path if (a.length==0) return b; if (b.length==0) return a; // slow path List<Annotation> combined = new ArrayList<Annotation>(a.length+b.length); combined.addAll(Arrays.asList(a)); OUTER: for (Annotation x : b) { for (int i=0; i<a.length; i++) { if (x.annotationType()==combined.get(i).annotationType()) { combined.set(i,x); // override // depends on control dependency: [if], data = [none] continue OUTER; } } // not overlapping. append combined.add(x); // depends on control dependency: [for], data = [x] } return combined.toArray(new Annotation[combined.size()]); } }
public class class_name { @Override public void copyFrom(final CopyFrom obj) { final FeedInformationImpl info = (FeedInformationImpl) obj; setAuthor(info.getAuthor()); setBlock(info.getBlock()); getCategories().clear(); if (info.getCategories() != null) { getCategories().addAll(info.getCategories()); } setComplete(info.getComplete()); setNewFeedUrl(info.getNewFeedUrl()); setExplicit(info.getExplicit()); try { if (info.getImage() != null) { setImage(new URL(info.getImage().toExternalForm())); } } catch (final MalformedURLException e) { LOG.debug("Error copying URL:" + info.getImage(), e); } if (info.getKeywords() != null) { setKeywords(info.getKeywords().clone()); } setOwnerEmailAddress(info.getOwnerEmailAddress()); setOwnerName(info.getOwnerName()); setSubtitle(info.getSubtitle()); setSummary(info.getSummary()); } }
public class class_name { @Override public void copyFrom(final CopyFrom obj) { final FeedInformationImpl info = (FeedInformationImpl) obj; setAuthor(info.getAuthor()); setBlock(info.getBlock()); getCategories().clear(); if (info.getCategories() != null) { getCategories().addAll(info.getCategories()); // depends on control dependency: [if], data = [(info.getCategories()] } setComplete(info.getComplete()); setNewFeedUrl(info.getNewFeedUrl()); setExplicit(info.getExplicit()); try { if (info.getImage() != null) { setImage(new URL(info.getImage().toExternalForm())); // depends on control dependency: [if], data = [(info.getImage()] } } catch (final MalformedURLException e) { LOG.debug("Error copying URL:" + info.getImage(), e); } // depends on control dependency: [catch], data = [none] if (info.getKeywords() != null) { setKeywords(info.getKeywords().clone()); // depends on control dependency: [if], data = [(info.getKeywords()] } setOwnerEmailAddress(info.getOwnerEmailAddress()); setOwnerName(info.getOwnerName()); setSubtitle(info.getSubtitle()); setSummary(info.getSummary()); } }
public class class_name { public static <E> NavigableSet<E> unmodifiableNavigableSet(NavigableSet<E> set) { if (set instanceof ImmutableCollection || set instanceof UnmodifiableNavigableSet) { return set; } return new UnmodifiableNavigableSet<E>(set); } }
public class class_name { public static <E> NavigableSet<E> unmodifiableNavigableSet(NavigableSet<E> set) { if (set instanceof ImmutableCollection || set instanceof UnmodifiableNavigableSet) { return set; // depends on control dependency: [if], data = [none] } return new UnmodifiableNavigableSet<E>(set); } }
public class class_name { protected static void checkCreateSession () { if (_defaultSession == null) { // no need to sync Properties props = System.getProperties(); if (props.getProperty("mail.smtp.host") == null) { props.put("mail.smtp.host", "localhost"); } _defaultSession = Session.getDefaultInstance(props, null); } } }
public class class_name { protected static void checkCreateSession () { if (_defaultSession == null) { // no need to sync Properties props = System.getProperties(); if (props.getProperty("mail.smtp.host") == null) { props.put("mail.smtp.host", "localhost"); // depends on control dependency: [if], data = [none] } _defaultSession = Session.getDefaultInstance(props, null); // depends on control dependency: [if], data = [null)] } } }
public class class_name { @Override public IMonomer getMonomer(String monName, String strandName) { Strand strand = (Strand) strands.get(strandName); if (strand != null) { return (Monomer) strand.getMonomer(monName); } else { return null; } } }
public class class_name { @Override public IMonomer getMonomer(String monName, String strandName) { Strand strand = (Strand) strands.get(strandName); if (strand != null) { return (Monomer) strand.getMonomer(monName); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public String toHtml(Archipelago arch) { int mat[] = new int[rowNum()]; for (Island isl : arch.getIslands()) { for (Coordinate c : isl) { mat[c.row] = c.column; } } StringBuilder result = new StringBuilder("<table>\n<tr><td></td>\n"); ArrayList<String> colLabels = columnLabels(); for (String cLabel : colLabels) { result.append("<td>").append(cLabel).append("</td>"); } result.append("</tr>\n"); ArrayList<String> rLabels = rowLabels(); int row = 0; for (String label : rLabels) { result.append("<tr><td>").append(label).append("</td>"); if (mat[row] > 0) { result.append("<td colspan=\"").append(mat[row]).append("\"></td>").append("<td BGCOLOR=\"lightgreen\">M</td>"); } result.append("</tr>\n"); row++; } result.append("</table>"); return result.toString(); } }
public class class_name { public String toHtml(Archipelago arch) { int mat[] = new int[rowNum()]; for (Island isl : arch.getIslands()) { for (Coordinate c : isl) { mat[c.row] = c.column; // depends on control dependency: [for], data = [c] } } StringBuilder result = new StringBuilder("<table>\n<tr><td></td>\n"); ArrayList<String> colLabels = columnLabels(); for (String cLabel : colLabels) { result.append("<td>").append(cLabel).append("</td>"); // depends on control dependency: [for], data = [cLabel] } result.append("</tr>\n"); ArrayList<String> rLabels = rowLabels(); int row = 0; for (String label : rLabels) { result.append("<tr><td>").append(label).append("</td>"); // depends on control dependency: [for], data = [label] if (mat[row] > 0) { result.append("<td colspan=\"").append(mat[row]).append("\"></td>").append("<td BGCOLOR=\"lightgreen\">M</td>"); // depends on control dependency: [if], data = [(mat[row]] } result.append("</tr>\n"); // depends on control dependency: [for], data = [none] row++; // depends on control dependency: [for], data = [none] } result.append("</table>"); return result.toString(); } }
public class class_name { private PluralRule instantiateCustomPluralRuleClass(Class<? extends PluralRule> clazz) { PluralRule retVal; try { String pluralClassName = clazz.getName() + "_" + this.getLocale().getLanguage(); try { Class<?> pClass = Class.forName(pluralClassName); retVal = (PluralRule) pClass.newInstance(); } catch (ClassNotFoundException e) { retVal = clazz.newInstance(); } } catch (InstantiationException e) { throw new RuntimeException("Could not instantiate custom PluralRule class. " + "Make sure the class is not an abstract class or interface and has a default constructor.", e); } catch (IllegalAccessException e) { throw new RuntimeException("Could not instantiate custom Plural Rule class.", e); } return retVal; } }
public class class_name { private PluralRule instantiateCustomPluralRuleClass(Class<? extends PluralRule> clazz) { PluralRule retVal; try { String pluralClassName = clazz.getName() + "_" + this.getLocale().getLanguage(); try { Class<?> pClass = Class.forName(pluralClassName); retVal = (PluralRule) pClass.newInstance(); } catch (ClassNotFoundException e) { retVal = clazz.newInstance(); } // depends on control dependency: [catch], data = [none] } catch (InstantiationException e) { throw new RuntimeException("Could not instantiate custom PluralRule class. " + "Make sure the class is not an abstract class or interface and has a default constructor.", e); } catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none] throw new RuntimeException("Could not instantiate custom Plural Rule class.", e); } // depends on control dependency: [catch], data = [none] return retVal; } }
public class class_name { public static byte[] defaultMachineId() { byte[] bestMacAddr = bestAvailableMac(); if (bestMacAddr == null) { bestMacAddr = new byte[EUI64_MAC_ADDRESS_LENGTH]; PlatformDependent.threadLocalRandom().nextBytes(bestMacAddr); logger.warn( "Failed to find a usable hardware address from the network interfaces; using random bytes: {}", formatAddress(bestMacAddr)); } return bestMacAddr; } }
public class class_name { public static byte[] defaultMachineId() { byte[] bestMacAddr = bestAvailableMac(); if (bestMacAddr == null) { bestMacAddr = new byte[EUI64_MAC_ADDRESS_LENGTH]; // depends on control dependency: [if], data = [none] PlatformDependent.threadLocalRandom().nextBytes(bestMacAddr); // depends on control dependency: [if], data = [(bestMacAddr] logger.warn( "Failed to find a usable hardware address from the network interfaces; using random bytes: {}", formatAddress(bestMacAddr)); // depends on control dependency: [if], data = [none] } return bestMacAddr; } }
public class class_name { private void findSpecNameForGV(String jobnameLL) { int maxVersion = 0; StringBuilder key = new StringBuilder(); // alle param-segmente durchlaufen Map<String, String> bpd = passport.getBPD(); for (String path : bpd.keySet()) { key.setLength(0); key.append(path); if (key.indexOf("Params") == 0) { key.delete(0, key.indexOf(".") + 1); // wenn segment mit namen des aktuellen jobs gefunden wurde if (key.indexOf(jobnameLL + "Par") == 0 && key.toString().endsWith(".SegHead.code")) { key.delete(0, jobnameLL.length() + ("Par").length()); // extrahieren der versionsnummer aus dem spez-namen String st = key.substring(0, key.indexOf(".")); int version = 0; try { version = Integer.parseInt(st); } catch (Exception e) { log.warn("found invalid job version: key=" + key + ", jobnameLL=" + jobnameLL + " (this is a " + "known, but harmless bug)"); } // merken der größten jemals aufgetretenen versionsnummer if (version != 0) { log.debug("task " + jobnameLL + " is supported with segment version " + st); if (version > maxVersion) { maxVersion = version; } } } } } if (maxVersion == 0 && !jobnameLL.equals(GVRawSEPA.getLowlevelName())) { maxVersion = 1; log.warn("Using segment version " + maxVersion + " for job " + jobnameLL + ", although not found in BPD. " + "This may fail"); throw new JobNotSupportedException(jobnameLL); } // namen+versionsnummer speichern this.jobName = jobnameLL; this.segVersion = maxVersion; this.name = jobnameLL + this.segVersion; } }
public class class_name { private void findSpecNameForGV(String jobnameLL) { int maxVersion = 0; StringBuilder key = new StringBuilder(); // alle param-segmente durchlaufen Map<String, String> bpd = passport.getBPD(); for (String path : bpd.keySet()) { key.setLength(0); // depends on control dependency: [for], data = [none] key.append(path); // depends on control dependency: [for], data = [path] if (key.indexOf("Params") == 0) { key.delete(0, key.indexOf(".") + 1); // depends on control dependency: [if], data = [none] // wenn segment mit namen des aktuellen jobs gefunden wurde if (key.indexOf(jobnameLL + "Par") == 0 && key.toString().endsWith(".SegHead.code")) { key.delete(0, jobnameLL.length() + ("Par").length()); // depends on control dependency: [if], data = [none] // extrahieren der versionsnummer aus dem spez-namen String st = key.substring(0, key.indexOf(".")); int version = 0; try { version = Integer.parseInt(st); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.warn("found invalid job version: key=" + key + ", jobnameLL=" + jobnameLL + " (this is a " + "known, but harmless bug)"); } // depends on control dependency: [catch], data = [none] // merken der größten jemals aufgetretenen versionsnummer if (version != 0) { log.debug("task " + jobnameLL + " is supported with segment version " + st); // depends on control dependency: [if], data = [none] if (version > maxVersion) { maxVersion = version; // depends on control dependency: [if], data = [none] } } } } } if (maxVersion == 0 && !jobnameLL.equals(GVRawSEPA.getLowlevelName())) { maxVersion = 1; // depends on control dependency: [if], data = [none] log.warn("Using segment version " + maxVersion + " for job " + jobnameLL + ", although not found in BPD. " + "This may fail"); // depends on control dependency: [if], data = [none] throw new JobNotSupportedException(jobnameLL); } // namen+versionsnummer speichern this.jobName = jobnameLL; this.segVersion = maxVersion; this.name = jobnameLL + this.segVersion; } }
public class class_name { public void truncateAfter(long newTruncationPoint) { if (size() == 0) { m_map.add(range(newTruncationPoint, newTruncationPoint)); m_hasSentinel = true; return; } if (newTruncationPoint > getLastSeqNo()) { return; } final Iterator<Range<Long>> iter = m_map.asDescendingSetOfRanges().iterator(); while (iter.hasNext()) { final Range<Long> next = iter.next(); if (start(next) > newTruncationPoint) { iter.remove(); } else if (next.contains(newTruncationPoint)) { iter.remove(); m_map.add(range(start(next), newTruncationPoint)); return; } else { break; } } if (m_map.isEmpty()) { m_map.add(range(newTruncationPoint, newTruncationPoint)); m_hasSentinel = true; } } }
public class class_name { public void truncateAfter(long newTruncationPoint) { if (size() == 0) { m_map.add(range(newTruncationPoint, newTruncationPoint)); // depends on control dependency: [if], data = [none] m_hasSentinel = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (newTruncationPoint > getLastSeqNo()) { return; // depends on control dependency: [if], data = [none] } final Iterator<Range<Long>> iter = m_map.asDescendingSetOfRanges().iterator(); while (iter.hasNext()) { final Range<Long> next = iter.next(); if (start(next) > newTruncationPoint) { iter.remove(); // depends on control dependency: [if], data = [none] } else if (next.contains(newTruncationPoint)) { iter.remove(); // depends on control dependency: [if], data = [none] m_map.add(range(start(next), newTruncationPoint)); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else { break; } } if (m_map.isEmpty()) { m_map.add(range(newTruncationPoint, newTruncationPoint)); // depends on control dependency: [if], data = [none] m_hasSentinel = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static <T> Supplier<T> memoize(Supplier<T> original) { return new Supplier<T>() { Supplier<T> mDelegate = this::firstTime; boolean mInitialized; public T get() { return mDelegate.get(); } private synchronized T firstTime() { if (!mInitialized) { T value = original.get(); mDelegate = () -> value; mInitialized = true; } return mDelegate.get(); } }; } }
public class class_name { private static <T> Supplier<T> memoize(Supplier<T> original) { return new Supplier<T>() { Supplier<T> mDelegate = this::firstTime; boolean mInitialized; public T get() { return mDelegate.get(); } private synchronized T firstTime() { if (!mInitialized) { T value = original.get(); mDelegate = () -> value; mInitialized = true; // depends on control dependency: [if], data = [none] } return mDelegate.get(); } }; } }
public class class_name { private int generateTiles(TileMatrixDao tileMatrixDao, TileDao tileDao, Contents contents, int zoomLevel, TileGrid tileGrid, TileGrid localTileGrid, long matrixWidth, long matrixHeight, boolean update) throws SQLException, IOException { int count = 0; Integer tileWidth = null; Integer tileHeight = null; // Download and create the tile and each coordinate for (long x = tileGrid.getMinX(); x <= tileGrid.getMaxX(); x++) { // Check if the progress has been cancelled if (progress != null && !progress.isActive()) { break; } for (long y = tileGrid.getMinY(); y <= tileGrid.getMaxY(); y++) { // Check if the progress has been cancelled if (progress != null && !progress.isActive()) { break; } try { // Create the tile byte[] tileBytes = createTile(zoomLevel, x, y); if (tileBytes != null) { BufferedImage image = null; // Compress the image if (compressFormat != null) { image = ImageUtils.getImage(tileBytes); if (image != null) { tileBytes = ImageUtils.writeImageToBytes(image, compressFormat, compressQuality); } } // Create a new tile row TileRow newRow = tileDao.newRow(); newRow.setZoomLevel(zoomLevel); long tileColumn = x; long tileRow = y; // Update the column and row to the local tile grid // location if (localTileGrid != null) { tileColumn = (x - tileGrid.getMinX()) + localTileGrid.getMinX(); tileRow = (y - tileGrid.getMinY()) + localTileGrid.getMinY(); } // If an update, delete an existing row if (update) { tileDao.deleteTile(tileColumn, tileRow, zoomLevel); } newRow.setTileColumn(tileColumn); newRow.setTileRow(tileRow); newRow.setTileData(tileBytes); tileDao.create(newRow); count++; // Determine the tile width and height if (tileWidth == null) { if (image == null) { image = ImageUtils.getImage(tileBytes); } if (image != null) { tileWidth = image.getWidth(); tileHeight = image.getHeight(); } } } } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to create tile. Zoom: " + zoomLevel + ", x: " + x + ", y: " + y, e); // Skip this tile, don't increase count } // Update the progress count, even on failures if (progress != null) { progress.addZoomLevelProgress(zoomLevel, 1); progress.addProgress(1); } } } // If none of the tiles were translated into a bitmap with dimensions, // delete them if (tileWidth == null || tileHeight == null) { count = 0; StringBuilder where = new StringBuilder(); where.append(tileDao.buildWhere(TileTable.COLUMN_ZOOM_LEVEL, zoomLevel)); where.append(" AND "); where.append(tileDao.buildWhere(TileTable.COLUMN_TILE_COLUMN, tileGrid.getMinX(), ">=")); where.append(" AND "); where.append(tileDao.buildWhere(TileTable.COLUMN_TILE_COLUMN, tileGrid.getMaxX(), "<=")); where.append(" AND "); where.append(tileDao.buildWhere(TileTable.COLUMN_TILE_ROW, tileGrid.getMinY(), ">=")); where.append(" AND "); where.append(tileDao.buildWhere(TileTable.COLUMN_TILE_ROW, tileGrid.getMaxY(), "<=")); String[] whereArgs = tileDao.buildWhereArgs(new Object[] { zoomLevel, tileGrid.getMinX(), tileGrid.getMaxX(), tileGrid.getMinY(), tileGrid.getMaxY() }); tileDao.delete(where.toString(), whereArgs); } else { // Check if the tile matrix already exists boolean create = true; if (update) { create = !tileMatrixDao.idExists(new TileMatrixKey(tableName, zoomLevel)); } // Create the tile matrix if (create) { // Calculate meters per pixel double pixelXSize = (tileGridBoundingBox.getMaxLongitude() - tileGridBoundingBox .getMinLongitude()) / matrixWidth / tileWidth; double pixelYSize = (tileGridBoundingBox.getMaxLatitude() - tileGridBoundingBox .getMinLatitude()) / matrixHeight / tileHeight; // Create the tile matrix for this zoom level TileMatrix tileMatrix = new TileMatrix(); tileMatrix.setContents(contents); tileMatrix.setZoomLevel(zoomLevel); tileMatrix.setMatrixWidth(matrixWidth); tileMatrix.setMatrixHeight(matrixHeight); tileMatrix.setTileWidth(tileWidth); tileMatrix.setTileHeight(tileHeight); tileMatrix.setPixelXSize(pixelXSize); tileMatrix.setPixelYSize(pixelYSize); tileMatrixDao.create(tileMatrix); } } return count; } }
public class class_name { private int generateTiles(TileMatrixDao tileMatrixDao, TileDao tileDao, Contents contents, int zoomLevel, TileGrid tileGrid, TileGrid localTileGrid, long matrixWidth, long matrixHeight, boolean update) throws SQLException, IOException { int count = 0; Integer tileWidth = null; Integer tileHeight = null; // Download and create the tile and each coordinate for (long x = tileGrid.getMinX(); x <= tileGrid.getMaxX(); x++) { // Check if the progress has been cancelled if (progress != null && !progress.isActive()) { break; } for (long y = tileGrid.getMinY(); y <= tileGrid.getMaxY(); y++) { // Check if the progress has been cancelled if (progress != null && !progress.isActive()) { break; } try { // Create the tile byte[] tileBytes = createTile(zoomLevel, x, y); if (tileBytes != null) { BufferedImage image = null; // Compress the image if (compressFormat != null) { image = ImageUtils.getImage(tileBytes); // depends on control dependency: [if], data = [none] if (image != null) { tileBytes = ImageUtils.writeImageToBytes(image, compressFormat, compressQuality); // depends on control dependency: [if], data = [none] } } // Create a new tile row TileRow newRow = tileDao.newRow(); newRow.setZoomLevel(zoomLevel); // depends on control dependency: [if], data = [none] long tileColumn = x; long tileRow = y; // Update the column and row to the local tile grid // location if (localTileGrid != null) { tileColumn = (x - tileGrid.getMinX()) + localTileGrid.getMinX(); // depends on control dependency: [if], data = [none] tileRow = (y - tileGrid.getMinY()) + localTileGrid.getMinY(); // depends on control dependency: [if], data = [none] } // If an update, delete an existing row if (update) { tileDao.deleteTile(tileColumn, tileRow, zoomLevel); // depends on control dependency: [if], data = [none] } newRow.setTileColumn(tileColumn); // depends on control dependency: [if], data = [none] newRow.setTileRow(tileRow); // depends on control dependency: [if], data = [none] newRow.setTileData(tileBytes); // depends on control dependency: [if], data = [(tileBytes] tileDao.create(newRow); // depends on control dependency: [if], data = [none] count++; // depends on control dependency: [if], data = [none] // Determine the tile width and height if (tileWidth == null) { if (image == null) { image = ImageUtils.getImage(tileBytes); // depends on control dependency: [if], data = [none] } if (image != null) { tileWidth = image.getWidth(); // depends on control dependency: [if], data = [none] tileHeight = image.getHeight(); // depends on control dependency: [if], data = [none] } } } } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to create tile. Zoom: " + zoomLevel + ", x: " + x + ", y: " + y, e); // Skip this tile, don't increase count } // depends on control dependency: [catch], data = [none] // Update the progress count, even on failures if (progress != null) { progress.addZoomLevelProgress(zoomLevel, 1); // depends on control dependency: [if], data = [none] progress.addProgress(1); // depends on control dependency: [if], data = [none] } } } // If none of the tiles were translated into a bitmap with dimensions, // delete them if (tileWidth == null || tileHeight == null) { count = 0; StringBuilder where = new StringBuilder(); where.append(tileDao.buildWhere(TileTable.COLUMN_ZOOM_LEVEL, zoomLevel)); where.append(" AND "); where.append(tileDao.buildWhere(TileTable.COLUMN_TILE_COLUMN, tileGrid.getMinX(), ">=")); where.append(" AND "); where.append(tileDao.buildWhere(TileTable.COLUMN_TILE_COLUMN, tileGrid.getMaxX(), "<=")); where.append(" AND "); where.append(tileDao.buildWhere(TileTable.COLUMN_TILE_ROW, tileGrid.getMinY(), ">=")); where.append(" AND "); where.append(tileDao.buildWhere(TileTable.COLUMN_TILE_ROW, tileGrid.getMaxY(), "<=")); String[] whereArgs = tileDao.buildWhereArgs(new Object[] { zoomLevel, tileGrid.getMinX(), tileGrid.getMaxX(), tileGrid.getMinY(), tileGrid.getMaxY() }); tileDao.delete(where.toString(), whereArgs); } else { // Check if the tile matrix already exists boolean create = true; if (update) { create = !tileMatrixDao.idExists(new TileMatrixKey(tableName, zoomLevel)); // depends on control dependency: [if], data = [none] } // Create the tile matrix if (create) { // Calculate meters per pixel double pixelXSize = (tileGridBoundingBox.getMaxLongitude() - tileGridBoundingBox .getMinLongitude()) / matrixWidth / tileWidth; double pixelYSize = (tileGridBoundingBox.getMaxLatitude() - tileGridBoundingBox .getMinLatitude()) / matrixHeight / tileHeight; // Create the tile matrix for this zoom level TileMatrix tileMatrix = new TileMatrix(); tileMatrix.setContents(contents); // depends on control dependency: [if], data = [none] tileMatrix.setZoomLevel(zoomLevel); // depends on control dependency: [if], data = [none] tileMatrix.setMatrixWidth(matrixWidth); // depends on control dependency: [if], data = [none] tileMatrix.setMatrixHeight(matrixHeight); // depends on control dependency: [if], data = [none] tileMatrix.setTileWidth(tileWidth); // depends on control dependency: [if], data = [none] tileMatrix.setTileHeight(tileHeight); // depends on control dependency: [if], data = [none] tileMatrix.setPixelXSize(pixelXSize); // depends on control dependency: [if], data = [none] tileMatrix.setPixelYSize(pixelYSize); // depends on control dependency: [if], data = [none] tileMatrixDao.create(tileMatrix); // depends on control dependency: [if], data = [none] } } return count; } }
public class class_name { private String getNodeId(PatriciaTrie.PatriciaNode<V> node) { if (node == null) { return "null"; } else { return node.getKey(); } } }
public class class_name { private String getNodeId(PatriciaTrie.PatriciaNode<V> node) { if (node == null) { return "null"; // depends on control dependency: [if], data = [none] } else { return node.getKey(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void queueException(final String level, final String message, final Throwable e) { try { LogAppender<LogEvent> appender = LogManager.getAppender(); if (appender != null) { appender.append(LogEvent.newBuilder().level(level).message(message).exception(e).build()); } } catch (Throwable t) { LOGGER.info("Unable to queue exception to Stackify Log API service: {} {} {}", level, message, e, t); } } }
public class class_name { public static void queueException(final String level, final String message, final Throwable e) { try { LogAppender<LogEvent> appender = LogManager.getAppender(); if (appender != null) { appender.append(LogEvent.newBuilder().level(level).message(message).exception(e).build()); // depends on control dependency: [if], data = [none] } } catch (Throwable t) { LOGGER.info("Unable to queue exception to Stackify Log API service: {} {} {}", level, message, e, t); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public final void reload(final CClassLoaderConfig config) { if (this == CClassLoader.getRootLoader()) { return; } if (config == null) { return; } final CClassLoader parent = ((CClassLoader) this.getParent()); parent.removeLoader(this.name); if (this.isMandatory()) { CClassLoader.mandatoryLoadersMap.remove(this.getPath()); } final CClassLoader newLoader = CClassLoader.getLoader(parent.getPath() + "/" + this.name); newLoader.config = this.config; newLoader.booAlone = this.booAlone; newLoader.booMandatory = this.booMandatory; newLoader.booResourceOnly = this.booResourceOnly; newLoader.booDoNotForwardToParent = this.booDoNotForwardToParent; final List list = (List) config.getFilesMap().get(this.path); for (final Iterator f = list.iterator(); f.hasNext();) { final URL file = (URL) f.next(); newLoader.readDirectories(file); } final Iterator it = this.childrenMap.keySet().iterator(); while (it.hasNext()) { final CClassLoader child = (CClassLoader) this.childrenMap.get(it .next()); child.reload(); } this._destroy(null); if (newLoader.isMandatory()) { CClassLoader.mandatoryLoadersMap .put(newLoader.getPath(), newLoader); } newLoader.booInit = true; } }
public class class_name { public final void reload(final CClassLoaderConfig config) { if (this == CClassLoader.getRootLoader()) { return; // depends on control dependency: [if], data = [none] } if (config == null) { return; // depends on control dependency: [if], data = [none] } final CClassLoader parent = ((CClassLoader) this.getParent()); parent.removeLoader(this.name); if (this.isMandatory()) { CClassLoader.mandatoryLoadersMap.remove(this.getPath()); // depends on control dependency: [if], data = [none] } final CClassLoader newLoader = CClassLoader.getLoader(parent.getPath() + "/" + this.name); newLoader.config = this.config; newLoader.booAlone = this.booAlone; newLoader.booMandatory = this.booMandatory; newLoader.booResourceOnly = this.booResourceOnly; newLoader.booDoNotForwardToParent = this.booDoNotForwardToParent; final List list = (List) config.getFilesMap().get(this.path); for (final Iterator f = list.iterator(); f.hasNext();) { final URL file = (URL) f.next(); newLoader.readDirectories(file); // depends on control dependency: [for], data = [none] } final Iterator it = this.childrenMap.keySet().iterator(); while (it.hasNext()) { final CClassLoader child = (CClassLoader) this.childrenMap.get(it .next()); child.reload(); // depends on control dependency: [while], data = [none] } this._destroy(null); if (newLoader.isMandatory()) { CClassLoader.mandatoryLoadersMap .put(newLoader.getPath(), newLoader); // depends on control dependency: [if], data = [none] } newLoader.booInit = true; } }
public class class_name { @Pure public static int getPreferredLaneCount() { final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class); if (prefs != null) { return prefs.getInt("LANE_COUNT", DEFAULT_LANE_COUNT); //$NON-NLS-1$ } return DEFAULT_LANE_COUNT; } }
public class class_name { @Pure public static int getPreferredLaneCount() { final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class); if (prefs != null) { return prefs.getInt("LANE_COUNT", DEFAULT_LANE_COUNT); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } return DEFAULT_LANE_COUNT; } }
public class class_name { public void error(long requestId, String message, Object... args) { if (requestId != RequestTag.NON_EXISTENT_ID) { log.error(String.format("[requestId=%d] %s", requestId, message), args); } else { log.error(message, args); } } }
public class class_name { public void error(long requestId, String message, Object... args) { if (requestId != RequestTag.NON_EXISTENT_ID) { log.error(String.format("[requestId=%d] %s", requestId, message), args); // depends on control dependency: [if], data = [none] } else { log.error(message, args); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | NumberFormatException e) { logger.error("Could not get value of global property {} due to SecurityManager. Using default value.", key, e); return defaultValue; } } }
public class class_name { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); // depends on control dependency: [if], data = [none] } else { return Integer.parseInt(value); // depends on control dependency: [if], data = [(value] } } catch (SecurityException | NumberFormatException e) { logger.error("Could not get value of global property {} due to SecurityManager. Using default value.", key, e); return defaultValue; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setElements(List<AstNode> elements) { if (elements == null) { this.elements = null; } else { if (this.elements != null) this.elements.clear(); for (AstNode e : elements) addElement(e); } } }
public class class_name { public void setElements(List<AstNode> elements) { if (elements == null) { this.elements = null; // depends on control dependency: [if], data = [none] } else { if (this.elements != null) this.elements.clear(); for (AstNode e : elements) addElement(e); } } }
public class class_name { public void setResultList(java.util.Collection<BatchDetectDominantLanguageItemResult> resultList) { if (resultList == null) { this.resultList = null; return; } this.resultList = new java.util.ArrayList<BatchDetectDominantLanguageItemResult>(resultList); } }
public class class_name { public void setResultList(java.util.Collection<BatchDetectDominantLanguageItemResult> resultList) { if (resultList == null) { this.resultList = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.resultList = new java.util.ArrayList<BatchDetectDominantLanguageItemResult>(resultList); } }
public class class_name { public static CPDefinitionOptionValueRel toModel( CPDefinitionOptionValueRelSoap soapModel) { if (soapModel == null) { return null; } CPDefinitionOptionValueRel model = new CPDefinitionOptionValueRelImpl(); model.setUuid(soapModel.getUuid()); model.setCPDefinitionOptionValueRelId(soapModel.getCPDefinitionOptionValueRelId()); model.setGroupId(soapModel.getGroupId()); model.setCompanyId(soapModel.getCompanyId()); model.setUserId(soapModel.getUserId()); model.setUserName(soapModel.getUserName()); model.setCreateDate(soapModel.getCreateDate()); model.setModifiedDate(soapModel.getModifiedDate()); model.setCPDefinitionOptionRelId(soapModel.getCPDefinitionOptionRelId()); model.setName(soapModel.getName()); model.setPriority(soapModel.getPriority()); model.setKey(soapModel.getKey()); return model; } }
public class class_name { public static CPDefinitionOptionValueRel toModel( CPDefinitionOptionValueRelSoap soapModel) { if (soapModel == null) { return null; // depends on control dependency: [if], data = [none] } CPDefinitionOptionValueRel model = new CPDefinitionOptionValueRelImpl(); model.setUuid(soapModel.getUuid()); model.setCPDefinitionOptionValueRelId(soapModel.getCPDefinitionOptionValueRelId()); model.setGroupId(soapModel.getGroupId()); model.setCompanyId(soapModel.getCompanyId()); model.setUserId(soapModel.getUserId()); model.setUserName(soapModel.getUserName()); model.setCreateDate(soapModel.getCreateDate()); model.setModifiedDate(soapModel.getModifiedDate()); model.setCPDefinitionOptionRelId(soapModel.getCPDefinitionOptionRelId()); model.setName(soapModel.getName()); model.setPriority(soapModel.getPriority()); model.setKey(soapModel.getKey()); return model; } }
public class class_name { public static void extractParameterMap(final HttpServletRequest request, final Map<String, String[]> parameters, final Map<String, FileItem[]> files) { if (isMultipart(request)) { ServletFileUpload upload = new ServletFileUpload(); upload.setFileItemFactory(new DiskFileItemFactory()); try { List fileItems = upload.parseRequest(request); uploadFileItems(fileItems, parameters, files); } catch (FileUploadException ex) { throw new SystemException(ex); } // Include Query String Parameters (only if parameters were not included in the form fields) for (Object entry : request.getParameterMap().entrySet()) { Map.Entry<String, String[]> param = (Map.Entry<String, String[]>) entry; if (!parameters.containsKey(param.getKey())) { parameters.put(param.getKey(), param.getValue()); } } } else { parameters.putAll(request.getParameterMap()); } } }
public class class_name { public static void extractParameterMap(final HttpServletRequest request, final Map<String, String[]> parameters, final Map<String, FileItem[]> files) { if (isMultipart(request)) { ServletFileUpload upload = new ServletFileUpload(); upload.setFileItemFactory(new DiskFileItemFactory()); // depends on control dependency: [if], data = [none] try { List fileItems = upload.parseRequest(request); uploadFileItems(fileItems, parameters, files); // depends on control dependency: [try], data = [none] } catch (FileUploadException ex) { throw new SystemException(ex); } // depends on control dependency: [catch], data = [none] // Include Query String Parameters (only if parameters were not included in the form fields) for (Object entry : request.getParameterMap().entrySet()) { Map.Entry<String, String[]> param = (Map.Entry<String, String[]>) entry; if (!parameters.containsKey(param.getKey())) { parameters.put(param.getKey(), param.getValue()); // depends on control dependency: [if], data = [none] } } } else { parameters.putAll(request.getParameterMap()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String prepareCompositeKey(final SingularAttribute attribute, final MetamodelImpl metaModel, final Object compositeKey) { Field[] fields = attribute.getBindableJavaType().getDeclaredFields(); EmbeddableType embeddable = metaModel.embeddable(attribute.getBindableJavaType()); StringBuilder stringBuilder = new StringBuilder(); try { for (Field f : fields) { if (!ReflectUtils.isTransientOrStatic(f)) { if (metaModel.isEmbeddable(((AbstractAttribute) embeddable.getAttribute(f.getName())) .getBindableJavaType())) { f.setAccessible(true); stringBuilder.append( prepareCompositeKey((SingularAttribute) embeddable.getAttribute(f.getName()), metaModel, f.get(compositeKey))).append(LUCENE_COMPOSITE_KEY_SEPERATOR); } else { String fieldValue = PropertyAccessorHelper.getString(compositeKey, f); fieldValue = fieldValue.replaceAll("[^a-zA-Z0-9]", "_"); stringBuilder.append(fieldValue); stringBuilder.append(LUCENE_COMPOSITE_KEY_SEPERATOR); } } } } catch (IllegalAccessException e) { logger.error(e.getMessage()); } catch (IllegalArgumentException e) { logger.error("Error during prepare composite key, Caused by {}.", e); throw new PersistenceException(e); } if (stringBuilder.length() > 0) { stringBuilder.deleteCharAt(stringBuilder.lastIndexOf(LUCENE_COMPOSITE_KEY_SEPERATOR)); } return stringBuilder.toString(); } }
public class class_name { public static String prepareCompositeKey(final SingularAttribute attribute, final MetamodelImpl metaModel, final Object compositeKey) { Field[] fields = attribute.getBindableJavaType().getDeclaredFields(); EmbeddableType embeddable = metaModel.embeddable(attribute.getBindableJavaType()); StringBuilder stringBuilder = new StringBuilder(); try { for (Field f : fields) { if (!ReflectUtils.isTransientOrStatic(f)) { if (metaModel.isEmbeddable(((AbstractAttribute) embeddable.getAttribute(f.getName())) .getBindableJavaType())) { f.setAccessible(true); // depends on control dependency: [if], data = [none] stringBuilder.append( prepareCompositeKey((SingularAttribute) embeddable.getAttribute(f.getName()), metaModel, f.get(compositeKey))).append(LUCENE_COMPOSITE_KEY_SEPERATOR); // depends on control dependency: [if], data = [none] } else { String fieldValue = PropertyAccessorHelper.getString(compositeKey, f); fieldValue = fieldValue.replaceAll("[^a-zA-Z0-9]", "_"); // depends on control dependency: [if], data = [none] stringBuilder.append(fieldValue); // depends on control dependency: [if], data = [none] stringBuilder.append(LUCENE_COMPOSITE_KEY_SEPERATOR); // depends on control dependency: [if], data = [none] } } } } catch (IllegalAccessException e) { logger.error(e.getMessage()); } // depends on control dependency: [catch], data = [none] catch (IllegalArgumentException e) { logger.error("Error during prepare composite key, Caused by {}.", e); throw new PersistenceException(e); } // depends on control dependency: [catch], data = [none] if (stringBuilder.length() > 0) { stringBuilder.deleteCharAt(stringBuilder.lastIndexOf(LUCENE_COMPOSITE_KEY_SEPERATOR)); // depends on control dependency: [if], data = [none] } return stringBuilder.toString(); } }
public class class_name { public static Optional<OffsetRange<CharOffset>> charOffsetsOfWholeString(String s) { if (s.isEmpty()) { return Optional.absent(); } return Optional.of(charOffsetRange(0, s.length() - 1)); } }
public class class_name { public static Optional<OffsetRange<CharOffset>> charOffsetsOfWholeString(String s) { if (s.isEmpty()) { return Optional.absent(); // depends on control dependency: [if], data = [none] } return Optional.of(charOffsetRange(0, s.length() - 1)); } }
public class class_name { public void setDocumentLocator(Locator locator) { try { if (null == m_resultContentHandler) createResultContentHandler(m_result); } catch (TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } m_resultContentHandler.setDocumentLocator(locator); } }
public class class_name { public void setDocumentLocator(Locator locator) { try { if (null == m_resultContentHandler) createResultContentHandler(m_result); } catch (TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } // depends on control dependency: [catch], data = [none] m_resultContentHandler.setDocumentLocator(locator); } }
public class class_name { @Override public List<R> subList(int fromIndex, int toIndex) { List<R> r = new ArrayList<>(); Iterator<R> itr = iterator(); hudson.util.Iterators.skip(itr, fromIndex); for (int i=toIndex-fromIndex; i>0; i--) { r.add(itr.next()); } return r; } }
public class class_name { @Override public List<R> subList(int fromIndex, int toIndex) { List<R> r = new ArrayList<>(); Iterator<R> itr = iterator(); hudson.util.Iterators.skip(itr, fromIndex); for (int i=toIndex-fromIndex; i>0; i--) { r.add(itr.next()); // depends on control dependency: [for], data = [none] } return r; } }
public class class_name { public static String restrictHTML (String src, String[] regexes) { if (StringUtil.isBlank(src)) { return src; } ArrayList<String> list = new ArrayList<String>(); list.add(src); for (String regexe : regexes) { Pattern p = Pattern.compile(regexe, Pattern.CASE_INSENSITIVE); for (int jj=0; jj < list.size(); jj += 2) { String piece = list.get(jj); Matcher m = p.matcher(piece); if (m.find()) { list.set(jj, piece.substring(0, m.start())); list.add(jj + 1, piece.substring(m.start(), m.end())); list.add(jj + 2, piece.substring(m.end())); } } } // now, the even elements of list contain untrusted text, the // odd elements contain stuff that matched a regex StringBuilder buf = new StringBuilder(); for (int jj=0, nn = list.size(); jj < nn; jj++) { String s = list.get(jj); if (jj % 2 == 0) { s = s.replace("<", "&lt;"); s = s.replace(">", "&gt;"); } buf.append(s); } return buf.toString(); } }
public class class_name { public static String restrictHTML (String src, String[] regexes) { if (StringUtil.isBlank(src)) { return src; // depends on control dependency: [if], data = [none] } ArrayList<String> list = new ArrayList<String>(); list.add(src); for (String regexe : regexes) { Pattern p = Pattern.compile(regexe, Pattern.CASE_INSENSITIVE); for (int jj=0; jj < list.size(); jj += 2) { String piece = list.get(jj); Matcher m = p.matcher(piece); if (m.find()) { list.set(jj, piece.substring(0, m.start())); // depends on control dependency: [if], data = [none] list.add(jj + 1, piece.substring(m.start(), m.end())); // depends on control dependency: [if], data = [none] list.add(jj + 2, piece.substring(m.end())); // depends on control dependency: [if], data = [none] } } } // now, the even elements of list contain untrusted text, the // odd elements contain stuff that matched a regex StringBuilder buf = new StringBuilder(); for (int jj=0, nn = list.size(); jj < nn; jj++) { String s = list.get(jj); if (jj % 2 == 0) { s = s.replace("<", "&lt;"); // depends on control dependency: [if], data = [none] s = s.replace(">", "&gt;"); // depends on control dependency: [if], data = [none] } buf.append(s); // depends on control dependency: [for], data = [none] } return buf.toString(); } }
public class class_name { @SneakyThrows public void init(final ExtractorRuleDefinitionEntity ruleDefinitionEntity) { for (ExtractorRuleEntity each : ruleDefinitionEntity.getRules()) { rules.put(each.getId(), (SQLSegmentExtractor) Class.forName(each.getExtractorClass()).newInstance()); } } }
public class class_name { @SneakyThrows public void init(final ExtractorRuleDefinitionEntity ruleDefinitionEntity) { for (ExtractorRuleEntity each : ruleDefinitionEntity.getRules()) { rules.put(each.getId(), (SQLSegmentExtractor) Class.forName(each.getExtractorClass()).newInstance()); // depends on control dependency: [for], data = [each] } } }
public class class_name { private boolean startLoading(String name) { Set classesAndResources = (Set) cycleDetector.get(); if (classesAndResources != null && classesAndResources.contains(name)) return false; if (classesAndResources == null) { classesAndResources = new HashSet(3); cycleDetector.set(classesAndResources); } classesAndResources.add(name); return true; } }
public class class_name { private boolean startLoading(String name) { Set classesAndResources = (Set) cycleDetector.get(); if (classesAndResources != null && classesAndResources.contains(name)) return false; if (classesAndResources == null) { classesAndResources = new HashSet(3); // depends on control dependency: [if], data = [none] cycleDetector.set(classesAndResources); // depends on control dependency: [if], data = [(classesAndResources] } classesAndResources.add(name); return true; } }
public class class_name { public static GssapiAuth getAuthenticationMethod() { try { //Waffle-jna has jna as dependency, so if not available on classpath, just use standard authentication if (Platform.isWindows()) { try { Class.forName("waffle.windows.auth.impl.WindowsAuthProviderImpl"); return new WindowsNativeSspiAuthentication(); } catch (ClassNotFoundException cle) { //waffle not in the classpath } } } catch (Throwable cle) { //jna jar's are not in classpath } return new StandardGssapiAuthentication(); } }
public class class_name { public static GssapiAuth getAuthenticationMethod() { try { //Waffle-jna has jna as dependency, so if not available on classpath, just use standard authentication if (Platform.isWindows()) { try { Class.forName("waffle.windows.auth.impl.WindowsAuthProviderImpl"); return new WindowsNativeSspiAuthentication(); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException cle) { //waffle not in the classpath } // depends on control dependency: [catch], data = [none] } } catch (Throwable cle) { //jna jar's are not in classpath } // depends on control dependency: [catch], data = [none] return new StandardGssapiAuthentication(); } }