code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private boolean declaresFunctionOrClass(Node n) { if (n.isFunction() || n.isClass()) { return true; } if (n.isAssign() && (n.getLastChild().isFunction() || n.getLastChild().isClass())) { return true; } if (NodeUtil.isNameDeclaration(n) && n.getFirstChild().hasChildren() && (n.getFirstFirstChild().isFunction() || n.getFirstFirstChild().isClass())) { return true; } return false; } }
public class class_name { private boolean declaresFunctionOrClass(Node n) { if (n.isFunction() || n.isClass()) { return true; // depends on control dependency: [if], data = [none] } if (n.isAssign() && (n.getLastChild().isFunction() || n.getLastChild().isClass())) { return true; // depends on control dependency: [if], data = [none] } if (NodeUtil.isNameDeclaration(n) && n.getFirstChild().hasChildren() && (n.getFirstFirstChild().isFunction() || n.getFirstFirstChild().isClass())) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { @SuppressWarnings("PMD.AvoidCatchingThrowable") static String mkString(Object obj) { if (obj == null) { return "null"; } try { return obj.toString() + " (type is " + obj.getClass() + ")"; } catch (Throwable t) { return t.getClass().toString() + ": " + t.getMessage() + " (type is " + obj.getClass() + ")"; } } }
public class class_name { @SuppressWarnings("PMD.AvoidCatchingThrowable") static String mkString(Object obj) { if (obj == null) { return "null"; // depends on control dependency: [if], data = [none] } try { return obj.toString() + " (type is " + obj.getClass() + ")"; } catch (Throwable t) { return t.getClass().toString() + ": " + t.getMessage() + " (type is " + obj.getClass() + ")"; } } }
public class class_name { public void set_rolling_file_threshold (Logger logger, long rft) { if (logger == null) { return; } if (rft < LOGGING_MIN_RFT) { rft = LOGGING_MIN_RFT; } else if (rft > LOGGING_MAX_RFT) { rft = LOGGING_MAX_RFT; } String prefix = LOGGING_FILE_TARGET + LOGGING_SEPARATOR; Enumeration all_appenders = logger.getAllAppenders(); while (all_appenders.hasMoreElements()) { Appender appender = (Appender)all_appenders.nextElement(); if (appender.getName().indexOf(prefix) != -1) { TangoRollingFileAppender trfa = (TangoRollingFileAppender) appender; trfa.setMaximumFileSize(rft * 1024); } } } }
public class class_name { public void set_rolling_file_threshold (Logger logger, long rft) { if (logger == null) { return; // depends on control dependency: [if], data = [none] } if (rft < LOGGING_MIN_RFT) { rft = LOGGING_MIN_RFT; // depends on control dependency: [if], data = [none] } else if (rft > LOGGING_MAX_RFT) { rft = LOGGING_MAX_RFT; // depends on control dependency: [if], data = [none] } String prefix = LOGGING_FILE_TARGET + LOGGING_SEPARATOR; Enumeration all_appenders = logger.getAllAppenders(); while (all_appenders.hasMoreElements()) { Appender appender = (Appender)all_appenders.nextElement(); if (appender.getName().indexOf(prefix) != -1) { TangoRollingFileAppender trfa = (TangoRollingFileAppender) appender; trfa.setMaximumFileSize(rft * 1024); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static boolean isSpreadSafe(Expression expression) { if (expression instanceof MethodCallExpression) { return ((MethodCallExpression) expression).isSpreadSafe(); } if (expression instanceof PropertyExpression) { return ((PropertyExpression) expression).isSpreadSafe(); } return false; } }
public class class_name { public static boolean isSpreadSafe(Expression expression) { if (expression instanceof MethodCallExpression) { return ((MethodCallExpression) expression).isSpreadSafe(); // depends on control dependency: [if], data = [none] } if (expression instanceof PropertyExpression) { return ((PropertyExpression) expression).isSpreadSafe(); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public ListRobotApplicationsResult withRobotApplicationSummaries(RobotApplicationSummary... robotApplicationSummaries) { if (this.robotApplicationSummaries == null) { setRobotApplicationSummaries(new java.util.ArrayList<RobotApplicationSummary>(robotApplicationSummaries.length)); } for (RobotApplicationSummary ele : robotApplicationSummaries) { this.robotApplicationSummaries.add(ele); } return this; } }
public class class_name { public ListRobotApplicationsResult withRobotApplicationSummaries(RobotApplicationSummary... robotApplicationSummaries) { if (this.robotApplicationSummaries == null) { setRobotApplicationSummaries(new java.util.ArrayList<RobotApplicationSummary>(robotApplicationSummaries.length)); // depends on control dependency: [if], data = [none] } for (RobotApplicationSummary ele : robotApplicationSummaries) { this.robotApplicationSummaries.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static double oliverSimilarity(String text1, String text2) { preprocessDocument(text1); preprocessDocument(text2); String smallerDoc=text1; String biggerDoc=text2; if(text1.length()>text2.length()) { smallerDoc=text2; biggerDoc=text1; } double p=PHPSimilarText.similarityPercentage(smallerDoc, biggerDoc); p/=100.0; return p; } }
public class class_name { public static double oliverSimilarity(String text1, String text2) { preprocessDocument(text1); preprocessDocument(text2); String smallerDoc=text1; String biggerDoc=text2; if(text1.length()>text2.length()) { smallerDoc=text2; // depends on control dependency: [if], data = [none] biggerDoc=text1; // depends on control dependency: [if], data = [none] } double p=PHPSimilarText.similarityPercentage(smallerDoc, biggerDoc); p/=100.0; return p; } }
public class class_name { @Override public int computeVerticalScrollRange() { final int count = getChildCount(); final int contentHeight = getHeight() - getPaddingBottom() - getPaddingTop(); if (count == 0) { return contentHeight; } int scrollRange = getChildAt(0).getBottom(); final int scrollY = getScrollY(); final int overscrollBottom = Math.max(0, scrollRange - contentHeight); if (scrollY < 0) { scrollRange -= scrollY; } else if (scrollY > overscrollBottom) { scrollRange += scrollY - overscrollBottom; } return scrollRange; } }
public class class_name { @Override public int computeVerticalScrollRange() { final int count = getChildCount(); final int contentHeight = getHeight() - getPaddingBottom() - getPaddingTop(); if (count == 0) { return contentHeight; // depends on control dependency: [if], data = [none] } int scrollRange = getChildAt(0).getBottom(); final int scrollY = getScrollY(); final int overscrollBottom = Math.max(0, scrollRange - contentHeight); if (scrollY < 0) { scrollRange -= scrollY; // depends on control dependency: [if], data = [none] } else if (scrollY > overscrollBottom) { scrollRange += scrollY - overscrollBottom; // depends on control dependency: [if], data = [none] } return scrollRange; } }
public class class_name { @SuppressWarnings("unchecked") // Single-interface proxy creation guarded by parameter safety. public <T> T create(final Class<T> service) { Utils.validateServiceInterface(service); if (validateEagerly) { eagerlyValidateMethods(service); } return (T) Proxy.newProxyInstance(service.getClassLoader(), new Class<?>[]{service}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object... args) throws Throwable { // If the method is a method from Object then defer to normal invocation. if (method.getDeclaringClass() == Object.class) { return method.invoke(this, args); } return loadMethodHandler(method).invoke(args); } }); } }
public class class_name { @SuppressWarnings("unchecked") // Single-interface proxy creation guarded by parameter safety. public <T> T create(final Class<T> service) { Utils.validateServiceInterface(service); if (validateEagerly) { eagerlyValidateMethods(service); // depends on control dependency: [if], data = [none] } return (T) Proxy.newProxyInstance(service.getClassLoader(), new Class<?>[]{service}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object... args) throws Throwable { // If the method is a method from Object then defer to normal invocation. if (method.getDeclaringClass() == Object.class) { return method.invoke(this, args); } return loadMethodHandler(method).invoke(args); } }); } }
public class class_name { private Set<String> checkPreResolvedExistAndSetFullName(Set<String> preResolved, SelectionContext selectionContext) { Set<String> preResolvedSymbolicNames = new LinkedHashSet<String>(preResolved.size()); for (String preResolvedFeatureName : preResolved) { ProvisioningFeatureDefinition preResolvedDef = selectionContext.getRepository().getFeature(preResolvedFeatureName); if (preResolvedDef == null) { return Collections.emptySet(); } else { preResolvedSymbolicNames.add(preResolvedDef.getSymbolicName()); } } return preResolvedSymbolicNames; } }
public class class_name { private Set<String> checkPreResolvedExistAndSetFullName(Set<String> preResolved, SelectionContext selectionContext) { Set<String> preResolvedSymbolicNames = new LinkedHashSet<String>(preResolved.size()); for (String preResolvedFeatureName : preResolved) { ProvisioningFeatureDefinition preResolvedDef = selectionContext.getRepository().getFeature(preResolvedFeatureName); if (preResolvedDef == null) { return Collections.emptySet(); // depends on control dependency: [if], data = [none] } else { preResolvedSymbolicNames.add(preResolvedDef.getSymbolicName()); // depends on control dependency: [if], data = [(preResolvedDef] } } return preResolvedSymbolicNames; } }
public class class_name { public void applyAll(long index) { if (!log.isOpen()) return; // If the effective commit index is greater than the last index applied to the state machine then apply remaining entries. long lastIndex = Math.min(index, log.lastIndex()); if (lastIndex > lastApplied) { for (long i = lastApplied + 1; i <= lastIndex; i++) { Entry entry = log.get(i); if (entry != null) { apply(entry).whenComplete((result, error) -> entry.release()); } setLastApplied(i); } } } }
public class class_name { public void applyAll(long index) { if (!log.isOpen()) return; // If the effective commit index is greater than the last index applied to the state machine then apply remaining entries. long lastIndex = Math.min(index, log.lastIndex()); if (lastIndex > lastApplied) { for (long i = lastApplied + 1; i <= lastIndex; i++) { Entry entry = log.get(i); if (entry != null) { apply(entry).whenComplete((result, error) -> entry.release()); // depends on control dependency: [if], data = [(entry] } setLastApplied(i); // depends on control dependency: [for], data = [i] } } } }
public class class_name { public static Message getMessage(final Supplier<?> supplier, final MessageFactory messageFactory) { if (supplier == null) { return null; } final Object result = supplier.get(); return result instanceof Message ? (Message) result : messageFactory.newMessage(result); } }
public class class_name { public static Message getMessage(final Supplier<?> supplier, final MessageFactory messageFactory) { if (supplier == null) { return null; // depends on control dependency: [if], data = [none] } final Object result = supplier.get(); return result instanceof Message ? (Message) result : messageFactory.newMessage(result); } }
public class class_name { public void marshall(RejectedLogEventsInfo rejectedLogEventsInfo, ProtocolMarshaller protocolMarshaller) { if (rejectedLogEventsInfo == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(rejectedLogEventsInfo.getTooNewLogEventStartIndex(), TOONEWLOGEVENTSTARTINDEX_BINDING); protocolMarshaller.marshall(rejectedLogEventsInfo.getTooOldLogEventEndIndex(), TOOOLDLOGEVENTENDINDEX_BINDING); protocolMarshaller.marshall(rejectedLogEventsInfo.getExpiredLogEventEndIndex(), EXPIREDLOGEVENTENDINDEX_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RejectedLogEventsInfo rejectedLogEventsInfo, ProtocolMarshaller protocolMarshaller) { if (rejectedLogEventsInfo == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(rejectedLogEventsInfo.getTooNewLogEventStartIndex(), TOONEWLOGEVENTSTARTINDEX_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(rejectedLogEventsInfo.getTooOldLogEventEndIndex(), TOOOLDLOGEVENTENDINDEX_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(rejectedLogEventsInfo.getExpiredLogEventEndIndex(), EXPIREDLOGEVENTENDINDEX_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 fixDeclaringClass(DeclarationExpression newDeclExpr) { if (newDeclExpr.getDeclaringClass() == null && currentMethod != null) { newDeclExpr.setDeclaringClass(currentMethod.getDeclaringClass()); } } }
public class class_name { private void fixDeclaringClass(DeclarationExpression newDeclExpr) { if (newDeclExpr.getDeclaringClass() == null && currentMethod != null) { newDeclExpr.setDeclaringClass(currentMethod.getDeclaringClass()); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected synchronized void setDestLimits(long newDestHighMsgs, long newDestLowMsgs) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setDestLimits", new Object[] { new Long(newDestHighMsgs), new Long(newDestLowMsgs) }); _destHighMsgs = newDestHighMsgs; if (newDestLowMsgs >= _destHighMsgs) { //defect 244425: it is not sensible to allow the destLowMessages //watermark to be set higher than destinationHighMessages long decrease = (long) (_destHighMsgs * destinationHandler.getMessageProcessor().getCustomProperties().get_dest_low_unset_percentage_decrease()); _destLowMsgs = _destHighMsgs - decrease; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "setDestLowMsgs", "Cannot set destLowMsgs to be higher than destHighMsgs. New destLowMsgs=" + _destLowMsgs); } else { _destLowMsgs = newDestLowMsgs; } // If we're logging or monitoring the high/low limits or message depth intervals we need // to set the MsgStore watermarks accordingly (510343) if (isThresholdNotificationRequired()) updateWatermarks(getTotalMsgCount()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setDestLimits"); } }
public class class_name { protected synchronized void setDestLimits(long newDestHighMsgs, long newDestLowMsgs) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setDestLimits", new Object[] { new Long(newDestHighMsgs), new Long(newDestLowMsgs) }); _destHighMsgs = newDestHighMsgs; if (newDestLowMsgs >= _destHighMsgs) { //defect 244425: it is not sensible to allow the destLowMessages //watermark to be set higher than destinationHighMessages long decrease = (long) (_destHighMsgs * destinationHandler.getMessageProcessor().getCustomProperties().get_dest_low_unset_percentage_decrease()); _destLowMsgs = _destHighMsgs - decrease; // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "setDestLowMsgs", "Cannot set destLowMsgs to be higher than destHighMsgs. New destLowMsgs=" + _destLowMsgs); } else { _destLowMsgs = newDestLowMsgs; // depends on control dependency: [if], data = [none] } // If we're logging or monitoring the high/low limits or message depth intervals we need // to set the MsgStore watermarks accordingly (510343) if (isThresholdNotificationRequired()) updateWatermarks(getTotalMsgCount()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setDestLimits"); } }
public class class_name { public void addOneToManyValue(String name, AssociationValue value) { Attribute attribute = getAttributes().get(name); if (!(attribute instanceof OneToManyAttribute)) { throw new IllegalStateException("Cannot set oneToMany value on attribute with different type, " + attribute.getClass().getName() + " setting value " + value); } OneToManyAttribute oneToMany = (OneToManyAttribute) attribute; if (oneToMany.getValue() == null) { oneToMany.setValue(new ArrayList<AssociationValue>()); } oneToMany.getValue().add(value); } }
public class class_name { public void addOneToManyValue(String name, AssociationValue value) { Attribute attribute = getAttributes().get(name); if (!(attribute instanceof OneToManyAttribute)) { throw new IllegalStateException("Cannot set oneToMany value on attribute with different type, " + attribute.getClass().getName() + " setting value " + value); } OneToManyAttribute oneToMany = (OneToManyAttribute) attribute; if (oneToMany.getValue() == null) { oneToMany.setValue(new ArrayList<AssociationValue>()); // depends on control dependency: [if], data = [none] } oneToMany.getValue().add(value); } }
public class class_name { public synchronized void dump(Object _this, TraceComponent _tc, int bytesToDump) { int bytesRemainingToDump = bytesToDump; if (receivedBuffer != null) { SibTr.debug(this, tc, "Buffer contains a single underlying WsByteBuffer:"); dump(_this, _tc, receivedBuffer, bytesRemainingToDump, false); } else { SibTr.debug(this, tc, "Buffer contains " + dataList.size() + " underlying WsByteBuffer(s):"); for (int x = 0; x < dataList.size(); x++) { WsByteBuffer buff = dataList.get(x); dump(_this, _tc, buff, bytesRemainingToDump, true); // If we are not dumping the entire buffer if (bytesToDump != ENTIRE_BUFFER) { // Was there more in the buffer than we could dump anyway? if (buff.remaining() >= bytesRemainingToDump) { // If so - we are done bytesRemainingToDump = 0; } else { // Otherwise, decrement the amount left to dump bytesRemainingToDump -= buff.remaining(); } // Break out if nothing more to do if (bytesRemainingToDump <= 0) break; } } } } }
public class class_name { public synchronized void dump(Object _this, TraceComponent _tc, int bytesToDump) { int bytesRemainingToDump = bytesToDump; if (receivedBuffer != null) { SibTr.debug(this, tc, "Buffer contains a single underlying WsByteBuffer:"); // depends on control dependency: [if], data = [none] dump(_this, _tc, receivedBuffer, bytesRemainingToDump, false); // depends on control dependency: [if], data = [none] } else { SibTr.debug(this, tc, "Buffer contains " + dataList.size() + " underlying WsByteBuffer(s):"); // depends on control dependency: [if], data = [none] for (int x = 0; x < dataList.size(); x++) { WsByteBuffer buff = dataList.get(x); dump(_this, _tc, buff, bytesRemainingToDump, true); // depends on control dependency: [for], data = [none] // If we are not dumping the entire buffer if (bytesToDump != ENTIRE_BUFFER) { // Was there more in the buffer than we could dump anyway? if (buff.remaining() >= bytesRemainingToDump) { // If so - we are done bytesRemainingToDump = 0; // depends on control dependency: [if], data = [none] } else { // Otherwise, decrement the amount left to dump bytesRemainingToDump -= buff.remaining(); // depends on control dependency: [if], data = [none] } // Break out if nothing more to do if (bytesRemainingToDump <= 0) break; } } } } }
public class class_name { private static void addModal_(RootPaneContainer rootPane, Component component, ModalListener listener, Integer modalDepth) { synchronized (modals) { if (isModal(component) == false) { getModal(rootPane).addModal(component, listener, modalDepth); } } } }
public class class_name { private static void addModal_(RootPaneContainer rootPane, Component component, ModalListener listener, Integer modalDepth) { synchronized (modals) { if (isModal(component) == false) { getModal(rootPane).addModal(component, listener, modalDepth); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public String getFaultMessage() { String fmsg = null; Object fault = getFault(); if (fault != null) { if (fault instanceof Throwable) { fmsg = String.format(CommonKnowledgeMessages.MESSAGES.faultEncountered() + " [%s(message=%s)]: %s", fault.getClass().getName(), ((Throwable)fault).getMessage(), fault); } else { fmsg = String.format(CommonKnowledgeMessages.MESSAGES.faultEncountered() + " [%s]: %s", fault.getClass().getName(), fault); } } return fmsg; } }
public class class_name { public String getFaultMessage() { String fmsg = null; Object fault = getFault(); if (fault != null) { if (fault instanceof Throwable) { fmsg = String.format(CommonKnowledgeMessages.MESSAGES.faultEncountered() + " [%s(message=%s)]: %s", fault.getClass().getName(), ((Throwable)fault).getMessage(), fault); // depends on control dependency: [if], data = [none] } else { fmsg = String.format(CommonKnowledgeMessages.MESSAGES.faultEncountered() + " [%s]: %s", fault.getClass().getName(), fault); // depends on control dependency: [if], data = [none] } } return fmsg; } }
public class class_name { private String generateCacheControl(Map<MediaType, String> cacheControlMap, String contentType) { ArrayList<MediaType> mediaTypesList = new ArrayList<MediaType>(cacheControlMap.keySet()); Collections.sort(mediaTypesList, MediaTypeHelper.MEDIA_TYPE_COMPARATOR); String cacheControlValue = "no-cache"; if (contentType == null || contentType.equals("")) { return cacheControlValue; } for (MediaType mediaType : mediaTypesList) { if (contentType.equals(MediaType.WILDCARD)) { cacheControlValue = cacheControlMap.get(MediaType.WILDCARD_TYPE); break; } else if (mediaType.isCompatible(new MediaType(contentType.split("/")[0], contentType.split("/")[1]))) { cacheControlValue = cacheControlMap.get(mediaType); break; } } return cacheControlValue; } }
public class class_name { private String generateCacheControl(Map<MediaType, String> cacheControlMap, String contentType) { ArrayList<MediaType> mediaTypesList = new ArrayList<MediaType>(cacheControlMap.keySet()); Collections.sort(mediaTypesList, MediaTypeHelper.MEDIA_TYPE_COMPARATOR); String cacheControlValue = "no-cache"; if (contentType == null || contentType.equals("")) { return cacheControlValue; // depends on control dependency: [if], data = [none] } for (MediaType mediaType : mediaTypesList) { if (contentType.equals(MediaType.WILDCARD)) { cacheControlValue = cacheControlMap.get(MediaType.WILDCARD_TYPE); // depends on control dependency: [if], data = [none] break; } else if (mediaType.isCompatible(new MediaType(contentType.split("/")[0], contentType.split("/")[1]))) { cacheControlValue = cacheControlMap.get(mediaType); // depends on control dependency: [if], data = [none] break; } } return cacheControlValue; } }
public class class_name { public EList<EObject> getValues() { if (values == null) { values = new EObjectResolvingEList<EObject>(EObject.class, this, TypesPackage.JVM_CUSTOM_ANNOTATION_VALUE__VALUES); } return values; } }
public class class_name { public EList<EObject> getValues() { if (values == null) { values = new EObjectResolvingEList<EObject>(EObject.class, this, TypesPackage.JVM_CUSTOM_ANNOTATION_VALUE__VALUES); // depends on control dependency: [if], data = [none] } return values; } }
public class class_name { private PMap<TypedScope, OverlayScope> trimScopes(TypedScope scope) { TypedScope thisScope = syntacticScope; TypedScope thatScope = scope; int thisDepth = thisScope.getDepth(); int thatDepth = thatScope.getDepth(); PMap<TypedScope, OverlayScope> result = scopes; while (thatDepth > thisDepth) { thatScope = thatScope.getParent(); thatDepth--; } while (thisDepth > thatDepth) { result = result.minus(thisScope); thisScope = thisScope.getParent(); thisDepth--; } while (thisScope != thatScope && thisScope != null && thatScope != null) { result = result.minus(thisScope); thisScope = thisScope.getParent(); thatScope = thatScope.getParent(); } return result; } }
public class class_name { private PMap<TypedScope, OverlayScope> trimScopes(TypedScope scope) { TypedScope thisScope = syntacticScope; TypedScope thatScope = scope; int thisDepth = thisScope.getDepth(); int thatDepth = thatScope.getDepth(); PMap<TypedScope, OverlayScope> result = scopes; while (thatDepth > thisDepth) { thatScope = thatScope.getParent(); // depends on control dependency: [while], data = [none] thatDepth--; // depends on control dependency: [while], data = [none] } while (thisDepth > thatDepth) { result = result.minus(thisScope); // depends on control dependency: [while], data = [none] thisScope = thisScope.getParent(); // depends on control dependency: [while], data = [none] thisDepth--; // depends on control dependency: [while], data = [none] } while (thisScope != thatScope && thisScope != null && thatScope != null) { result = result.minus(thisScope); // depends on control dependency: [while], data = [(thisScope] thisScope = thisScope.getParent(); // depends on control dependency: [while], data = [none] thatScope = thatScope.getParent(); // depends on control dependency: [while], data = [none] } return result; } }
public class class_name { protected void loadOptionalPool(final String poolBinder) { try { final Method bindPool = OrientModule.class.getDeclaredMethod("bindPool", Class.class, Class.class); bindPool.setAccessible(true); try { Class.forName(poolBinder) .getConstructor(OrientModule.class, Method.class, Binder.class) .newInstance(this, bindPool, binder()); } finally { bindPool.setAccessible(false); } } catch (Exception ignored) { if (logger.isTraceEnabled()) { logger.trace("Failed to process pool loader " + poolBinder, ignored); } } } }
public class class_name { protected void loadOptionalPool(final String poolBinder) { try { final Method bindPool = OrientModule.class.getDeclaredMethod("bindPool", Class.class, Class.class); bindPool.setAccessible(true); try { Class.forName(poolBinder) .getConstructor(OrientModule.class, Method.class, Binder.class) .newInstance(this, bindPool, binder()); } finally { bindPool.setAccessible(false); } } catch (Exception ignored) { if (logger.isTraceEnabled()) { logger.trace("Failed to process pool loader " + poolBinder, ignored); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public Factory<?> getValueFactory(Parameter parameter) { if (type.equals(parameter.getRawType()) && parameter.isAnnotationPresent(Auth.class)) { return this; } return null; } }
public class class_name { @Override public Factory<?> getValueFactory(Parameter parameter) { if (type.equals(parameter.getRawType()) && parameter.isAnnotationPresent(Auth.class)) { return this; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static InitialContextToken decodeInitialContextToken(byte[] encodedToken, Codec codec) { if (encodedToken[0] != 0x60) return null; int encodedLength = 0; int n = 0; if (encodedToken[1] >= 0) encodedLength = encodedToken[1]; else { n = encodedToken[1] & 0x7F; for (int i = 1; i <= n; i++) { encodedLength += (encodedToken[1 + i] & 0xFF) << (n - i) * 8; } } int length = encodedLength - gssUpMechOidArray.length; byte[] encodedInitialContextToken = new byte[length]; System.arraycopy(encodedToken, 2 + n + gssUpMechOidArray.length, encodedInitialContextToken, 0, length); Any any; try { any = codec.decode_value(encodedInitialContextToken, InitialContextTokenHelper.type()); } catch (Exception e) { return null; } return InitialContextTokenHelper.extract(any); } }
public class class_name { public static InitialContextToken decodeInitialContextToken(byte[] encodedToken, Codec codec) { if (encodedToken[0] != 0x60) return null; int encodedLength = 0; int n = 0; if (encodedToken[1] >= 0) encodedLength = encodedToken[1]; else { n = encodedToken[1] & 0x7F; // depends on control dependency: [if], data = [none] for (int i = 1; i <= n; i++) { encodedLength += (encodedToken[1 + i] & 0xFF) << (n - i) * 8; // depends on control dependency: [for], data = [i] } } int length = encodedLength - gssUpMechOidArray.length; byte[] encodedInitialContextToken = new byte[length]; System.arraycopy(encodedToken, 2 + n + gssUpMechOidArray.length, encodedInitialContextToken, 0, length); Any any; try { any = codec.decode_value(encodedInitialContextToken, InitialContextTokenHelper.type()); // depends on control dependency: [try], data = [none] } catch (Exception e) { return null; } // depends on control dependency: [catch], data = [none] return InitialContextTokenHelper.extract(any); } }
public class class_name { private void barrier() { long sleepTime; while ((sleepTime = startTime - System.currentTimeMillis()) > 0) { try { Thread.sleep(sleepTime); } catch (InterruptedException ex) { } } } }
public class class_name { private void barrier() { long sleepTime; while ((sleepTime = startTime - System.currentTimeMillis()) > 0) { try { Thread.sleep(sleepTime); // depends on control dependency: [try], data = [none] } catch (InterruptedException ex) { } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void marshall(InstanceGroupConfig instanceGroupConfig, ProtocolMarshaller protocolMarshaller) { if (instanceGroupConfig == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(instanceGroupConfig.getName(), NAME_BINDING); protocolMarshaller.marshall(instanceGroupConfig.getMarket(), MARKET_BINDING); protocolMarshaller.marshall(instanceGroupConfig.getInstanceRole(), INSTANCEROLE_BINDING); protocolMarshaller.marshall(instanceGroupConfig.getBidPrice(), BIDPRICE_BINDING); protocolMarshaller.marshall(instanceGroupConfig.getInstanceType(), INSTANCETYPE_BINDING); protocolMarshaller.marshall(instanceGroupConfig.getInstanceCount(), INSTANCECOUNT_BINDING); protocolMarshaller.marshall(instanceGroupConfig.getConfigurations(), CONFIGURATIONS_BINDING); protocolMarshaller.marshall(instanceGroupConfig.getEbsConfiguration(), EBSCONFIGURATION_BINDING); protocolMarshaller.marshall(instanceGroupConfig.getAutoScalingPolicy(), AUTOSCALINGPOLICY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(InstanceGroupConfig instanceGroupConfig, ProtocolMarshaller protocolMarshaller) { if (instanceGroupConfig == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(instanceGroupConfig.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(instanceGroupConfig.getMarket(), MARKET_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(instanceGroupConfig.getInstanceRole(), INSTANCEROLE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(instanceGroupConfig.getBidPrice(), BIDPRICE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(instanceGroupConfig.getInstanceType(), INSTANCETYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(instanceGroupConfig.getInstanceCount(), INSTANCECOUNT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(instanceGroupConfig.getConfigurations(), CONFIGURATIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(instanceGroupConfig.getEbsConfiguration(), EBSCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(instanceGroupConfig.getAutoScalingPolicy(), AUTOSCALINGPOLICY_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void collectFeatures(String prefix, String suffix, String previous, String next, char eosChar) { buf.append("x="); buf.append(prefix); collectFeats.add(buf.toString()); buf.setLength(0); if (!prefix.equals("")) { collectFeats.add(Integer.toString(prefix.length())); if (isFirstUpper(prefix)) { collectFeats.add("xcap"); } if (inducedAbbreviations.contains(prefix + eosChar)) { collectFeats.add("xabbrev"); } char c = prefix.charAt(0); if (prefix.length() == 1 && Character.isLetter(c) && Character.isUpperCase(c) && eosChar == '.') { // looks like name abb collectFeats.add("xnabb"); } } buf.append("v="); buf.append(previous); collectFeats.add(buf.toString()); buf.setLength(0); if (!previous.equals("")) { if (isFirstUpper(previous)) { collectFeats.add("vcap"); } if (inducedAbbreviations.contains(previous)) { collectFeats.add("vabbrev"); } } buf.append("s="); buf.append(suffix); collectFeats.add(buf.toString()); buf.setLength(0); if (!suffix.equals("")) { if (isFirstUpper(suffix)) { collectFeats.add("scap"); } if (inducedAbbreviations.contains(suffix)) { collectFeats.add("sabbrev"); } } buf.append("n="); buf.append(next); collectFeats.add(buf.toString()); buf.setLength(0); if (!next.equals("")) { if (isFirstUpper(next)) { collectFeats.add("ncap"); } if (inducedAbbreviations.contains(next)) { collectFeats.add("nabbrev"); } } } }
public class class_name { protected void collectFeatures(String prefix, String suffix, String previous, String next, char eosChar) { buf.append("x="); buf.append(prefix); collectFeats.add(buf.toString()); buf.setLength(0); if (!prefix.equals("")) { collectFeats.add(Integer.toString(prefix.length())); // depends on control dependency: [if], data = [none] if (isFirstUpper(prefix)) { collectFeats.add("xcap"); // depends on control dependency: [if], data = [none] } if (inducedAbbreviations.contains(prefix + eosChar)) { collectFeats.add("xabbrev"); // depends on control dependency: [if], data = [none] } char c = prefix.charAt(0); if (prefix.length() == 1 && Character.isLetter(c) && Character.isUpperCase(c) && eosChar == '.') { // looks like name abb collectFeats.add("xnabb"); // depends on control dependency: [if], data = [none] } } buf.append("v="); buf.append(previous); collectFeats.add(buf.toString()); buf.setLength(0); if (!previous.equals("")) { if (isFirstUpper(previous)) { collectFeats.add("vcap"); // depends on control dependency: [if], data = [none] } if (inducedAbbreviations.contains(previous)) { collectFeats.add("vabbrev"); // depends on control dependency: [if], data = [none] } } buf.append("s="); buf.append(suffix); collectFeats.add(buf.toString()); buf.setLength(0); if (!suffix.equals("")) { if (isFirstUpper(suffix)) { collectFeats.add("scap"); // depends on control dependency: [if], data = [none] } if (inducedAbbreviations.contains(suffix)) { collectFeats.add("sabbrev"); // depends on control dependency: [if], data = [none] } } buf.append("n="); buf.append(next); collectFeats.add(buf.toString()); buf.setLength(0); if (!next.equals("")) { if (isFirstUpper(next)) { collectFeats.add("ncap"); // depends on control dependency: [if], data = [none] } if (inducedAbbreviations.contains(next)) { collectFeats.add("nabbrev"); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private List<Task> runWorkUnits(CountUpAndDownLatch countDownLatch) { List<Task> tasks = Lists.newArrayList(); while (this.workUnits.hasNext()) { WorkUnit workUnit = this.workUnits.next(); String taskId = workUnit.getProp(ConfigurationKeys.TASK_ID_KEY); // skip tasks that executed successsfully in a prior attempt if (taskSuccessfulInPriorAttempt(taskId)) { continue; } SubscopedBrokerBuilder<GobblinScopeTypes, ?> taskBrokerBuilder = this.jobBroker.newSubscopedBuilder(new TaskScopeInstance(taskId)); WorkUnitState workUnitState = new WorkUnitState(workUnit, this.jobState, taskBrokerBuilder); workUnitState.setId(taskId); workUnitState.setProp(ConfigurationKeys.JOB_ID_KEY, this.jobId); workUnitState.setProp(ConfigurationKeys.TASK_ID_KEY, taskId); if (this.containerIdOptional.isPresent()) { workUnitState.setProp(ConfigurationKeys.TASK_ATTEMPT_ID_KEY, this.containerIdOptional.get()); } // Create a new task from the work unit and submit the task to run. // If an exception occurs here then the count down latch is decremented // to avoid being stuck waiting for a task that was not created and submitted successfully. Task task = null; try { countDownLatch.countUp(); task = createTaskRunnable(workUnitState, countDownLatch); this.taskStateTracker.registerNewTask(task); task.setTaskFuture(this.taskExecutor.submit(task)); tasks.add(task); } catch (Throwable e) { if (e instanceof OutOfMemoryError) { log.error("Encountering memory error in task creation/execution stage, please investigate memory usage:", e); printMemoryUsage(); } if (task == null) { // task could not be created, so directly count down countDownLatch.countDown(); log.error("Could not create task for workunit {}", workUnit, e); } else if (!task.hasTaskFuture()) { // Task was created and may have been registered, but not submitted, so call the // task state tracker task run completion directly since the task cancel does nothing if not submitted this.taskStateTracker.onTaskRunCompletion(task); log.error("Could not submit task for workunit {}", workUnit, e); } else { // task was created and submitted, but failed later, so cancel the task to decrement the CountDownLatch task.cancel(); log.error("Failure after task submitted for workunit {}", workUnit, e); } } } new EventSubmitter.Builder(JobMetrics.get(this.jobId).getMetricContext(), "gobblin.runtime").build() .submit(JobEvent.TASKS_SUBMITTED, "tasksCount", Long.toString(countDownLatch.getRegisteredParties())); return tasks; } }
public class class_name { private List<Task> runWorkUnits(CountUpAndDownLatch countDownLatch) { List<Task> tasks = Lists.newArrayList(); while (this.workUnits.hasNext()) { WorkUnit workUnit = this.workUnits.next(); String taskId = workUnit.getProp(ConfigurationKeys.TASK_ID_KEY); // skip tasks that executed successsfully in a prior attempt if (taskSuccessfulInPriorAttempt(taskId)) { continue; } SubscopedBrokerBuilder<GobblinScopeTypes, ?> taskBrokerBuilder = this.jobBroker.newSubscopedBuilder(new TaskScopeInstance(taskId)); WorkUnitState workUnitState = new WorkUnitState(workUnit, this.jobState, taskBrokerBuilder); workUnitState.setId(taskId); // depends on control dependency: [while], data = [none] workUnitState.setProp(ConfigurationKeys.JOB_ID_KEY, this.jobId); // depends on control dependency: [while], data = [none] workUnitState.setProp(ConfigurationKeys.TASK_ID_KEY, taskId); // depends on control dependency: [while], data = [none] if (this.containerIdOptional.isPresent()) { workUnitState.setProp(ConfigurationKeys.TASK_ATTEMPT_ID_KEY, this.containerIdOptional.get()); // depends on control dependency: [if], data = [none] } // Create a new task from the work unit and submit the task to run. // If an exception occurs here then the count down latch is decremented // to avoid being stuck waiting for a task that was not created and submitted successfully. Task task = null; try { countDownLatch.countUp(); // depends on control dependency: [try], data = [none] task = createTaskRunnable(workUnitState, countDownLatch); // depends on control dependency: [try], data = [none] this.taskStateTracker.registerNewTask(task); // depends on control dependency: [try], data = [none] task.setTaskFuture(this.taskExecutor.submit(task)); // depends on control dependency: [try], data = [none] tasks.add(task); // depends on control dependency: [try], data = [none] } catch (Throwable e) { if (e instanceof OutOfMemoryError) { log.error("Encountering memory error in task creation/execution stage, please investigate memory usage:", e); // depends on control dependency: [if], data = [none] printMemoryUsage(); // depends on control dependency: [if], data = [none] } if (task == null) { // task could not be created, so directly count down countDownLatch.countDown(); // depends on control dependency: [if], data = [none] log.error("Could not create task for workunit {}", workUnit, e); // depends on control dependency: [if], data = [none] } else if (!task.hasTaskFuture()) { // Task was created and may have been registered, but not submitted, so call the // task state tracker task run completion directly since the task cancel does nothing if not submitted this.taskStateTracker.onTaskRunCompletion(task); // depends on control dependency: [if], data = [none] log.error("Could not submit task for workunit {}", workUnit, e); // depends on control dependency: [if], data = [none] } else { // task was created and submitted, but failed later, so cancel the task to decrement the CountDownLatch task.cancel(); // depends on control dependency: [if], data = [none] log.error("Failure after task submitted for workunit {}", workUnit, e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } new EventSubmitter.Builder(JobMetrics.get(this.jobId).getMetricContext(), "gobblin.runtime").build() .submit(JobEvent.TASKS_SUBMITTED, "tasksCount", Long.toString(countDownLatch.getRegisteredParties())); return tasks; } }
public class class_name { public static void setMatrix(final double[][] m1, final int[] r, final int c0, final int c1, final double[][] m2) { assert c0 <= c1 : ERR_INVALID_RANGE; assert c1 <= m1[0].length : ERR_MATRIX_DIMENSIONS; for(int i = 0; i < r.length; i++) { System.arraycopy(m2[i], 0, m1[r[i]], c0, c1 - c0); } } }
public class class_name { public static void setMatrix(final double[][] m1, final int[] r, final int c0, final int c1, final double[][] m2) { assert c0 <= c1 : ERR_INVALID_RANGE; assert c1 <= m1[0].length : ERR_MATRIX_DIMENSIONS; for(int i = 0; i < r.length; i++) { System.arraycopy(m2[i], 0, m1[r[i]], c0, c1 - c0); // depends on control dependency: [for], data = [i] } } }
public class class_name { public Optional<Annotation> getTarget(HString hString) { if (hString == null || hString.document() == null) { return Optional.empty(); } return hString.document().getAnnotation(target); } }
public class class_name { public Optional<Annotation> getTarget(HString hString) { if (hString == null || hString.document() == null) { return Optional.empty(); // depends on control dependency: [if], data = [none] } return hString.document().getAnnotation(target); } }
public class class_name { public static void setCustomProperties(Map<String, Object> d) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "setCustomProperties"); } String ky; String propertyKey; // For comparison purposes we need the mixed case key strings coming from metatype.xml and server.xml to be in lower case. Set<String> newKeySet = new HashSet<String>(); for (String key:d.keySet()) { newKeySet.add(key.toLowerCase()); } // go through each entry that is in the set of keys that we are getting from metatype.xml and server.xml for (Map.Entry<String, Object> entry : d.entrySet()) { ky = entry.getKey(); Object value = entry.getValue(); // using the lower case value of short or long name that was configured // see if the string maps to one of the short names in our table. // if it matches then get the long name back. otherwise keep the name as is. propertyKey = getStringKey(ky.toLowerCase()); if (!ky.equalsIgnoreCase(propertyKey)) { // found in map - check existence of fully qualified prop as well // if we mapped to a new long name, see if it is already in the passed in data because // configured long names have priority, and if it is in the table elsewhere, then don't use // this mapped short name value, because the long name was set in server.xml if (newKeySet.contains(propertyKey)) { continue; } } // store all values as lower case, so as to read them later in a consistent fashion propertyKey = propertyKey.toLowerCase(); if (value instanceof String) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Key: " + propertyKey + " type: String value: " + value); } customProps.setProperty(propertyKey, (String) value); } else if (value instanceof Boolean) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Key: " + propertyKey + " type: Boolean value: " + ((Boolean) value).toString()); } customProps.setProperty(propertyKey, ((Boolean) value).toString()); } else if (value instanceof Integer) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Key: " + propertyKey + " type: Integer value: " + ((Integer) value).toString()); } customProps.setProperty(propertyKey, ((Integer) value).toString()); } else { // don't update, not a custom property we care about here if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Key not processed due to type, Key: " + propertyKey); } } } setCustomPropertyVariables(); //Need to update all the variables. setCustomizedDefaultValues(); //Customize default value depending on servlet level, initial size....etc.. if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "setCustomProperties"); } } }
public class class_name { public static void setCustomProperties(Map<String, Object> d) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "setCustomProperties"); // depends on control dependency: [if], data = [none] } String ky; String propertyKey; // For comparison purposes we need the mixed case key strings coming from metatype.xml and server.xml to be in lower case. Set<String> newKeySet = new HashSet<String>(); for (String key:d.keySet()) { newKeySet.add(key.toLowerCase()); // depends on control dependency: [for], data = [key] } // go through each entry that is in the set of keys that we are getting from metatype.xml and server.xml for (Map.Entry<String, Object> entry : d.entrySet()) { ky = entry.getKey(); // depends on control dependency: [for], data = [entry] Object value = entry.getValue(); // using the lower case value of short or long name that was configured // see if the string maps to one of the short names in our table. // if it matches then get the long name back. otherwise keep the name as is. propertyKey = getStringKey(ky.toLowerCase()); // depends on control dependency: [for], data = [none] if (!ky.equalsIgnoreCase(propertyKey)) { // found in map - check existence of fully qualified prop as well // if we mapped to a new long name, see if it is already in the passed in data because // configured long names have priority, and if it is in the table elsewhere, then don't use // this mapped short name value, because the long name was set in server.xml if (newKeySet.contains(propertyKey)) { continue; } } // store all values as lower case, so as to read them later in a consistent fashion propertyKey = propertyKey.toLowerCase(); // depends on control dependency: [for], data = [none] if (value instanceof String) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Key: " + propertyKey + " type: String value: " + value); // depends on control dependency: [if], data = [none] } customProps.setProperty(propertyKey, (String) value); // depends on control dependency: [if], data = [none] } else if (value instanceof Boolean) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Key: " + propertyKey + " type: Boolean value: " + ((Boolean) value).toString()); // depends on control dependency: [if], data = [none] } customProps.setProperty(propertyKey, ((Boolean) value).toString()); // depends on control dependency: [if], data = [none] } else if (value instanceof Integer) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Key: " + propertyKey + " type: Integer value: " + ((Integer) value).toString()); // depends on control dependency: [if], data = [none] } customProps.setProperty(propertyKey, ((Integer) value).toString()); // depends on control dependency: [if], data = [none] } else { // don't update, not a custom property we care about here if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Key not processed due to type, Key: " + propertyKey); // depends on control dependency: [if], data = [none] } } } setCustomPropertyVariables(); //Need to update all the variables. setCustomizedDefaultValues(); //Customize default value depending on servlet level, initial size....etc.. if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "setCustomProperties"); // depends on control dependency: [if], data = [none] } } }
public class class_name { <T> void mockStatic(StaticMocking<T> mocking) { if (ExtendedMockito.staticMockMarker(mocking.clazz) != null) { throw new IllegalArgumentException(mocking.clazz + " is already mocked"); } mockingInProgressClass.set(mocking.clazz); try { classToMarker.put(mocking.clazz, mocking.markerSupplier.get()); } finally { mockingInProgressClass.remove(); } staticMocks.add(mocking.clazz); } }
public class class_name { <T> void mockStatic(StaticMocking<T> mocking) { if (ExtendedMockito.staticMockMarker(mocking.clazz) != null) { throw new IllegalArgumentException(mocking.clazz + " is already mocked"); } mockingInProgressClass.set(mocking.clazz); try { classToMarker.put(mocking.clazz, mocking.markerSupplier.get()); // depends on control dependency: [try], data = [none] } finally { mockingInProgressClass.remove(); } staticMocks.add(mocking.clazz); } }
public class class_name { public static ValueDataWrapper readValueData(int type, int orderNumber, File file, SpoolConfig spoolConfig) throws IOException { ValueDataWrapper vdDataWrapper = new ValueDataWrapper(); long fileSize = file.length(); vdDataWrapper.size = fileSize; if (fileSize > spoolConfig.maxBufferSize) { vdDataWrapper.value = new FilePersistedValueData(orderNumber, file, spoolConfig); } else { // JCR-2463 In case the file was renamed to be removed/changed, // but the transaction wasn't rollbacked cleanly file = fixFileName(file); FileInputStream is = new FileInputStream(file); try { byte[] data = new byte[(int)fileSize]; byte[] buff = new byte[ValueFileIOHelper.IOBUFFER_SIZE > fileSize ? ValueFileIOHelper.IOBUFFER_SIZE : (int)fileSize]; int rpos = 0; int read; while ((read = is.read(buff)) >= 0) { System.arraycopy(buff, 0, data, rpos, read); rpos += read; } vdDataWrapper.value = createValueData(type, orderNumber, data); } finally { is.close(); } } return vdDataWrapper; } }
public class class_name { public static ValueDataWrapper readValueData(int type, int orderNumber, File file, SpoolConfig spoolConfig) throws IOException { ValueDataWrapper vdDataWrapper = new ValueDataWrapper(); long fileSize = file.length(); vdDataWrapper.size = fileSize; if (fileSize > spoolConfig.maxBufferSize) { vdDataWrapper.value = new FilePersistedValueData(orderNumber, file, spoolConfig); } else { // JCR-2463 In case the file was renamed to be removed/changed, // but the transaction wasn't rollbacked cleanly file = fixFileName(file); FileInputStream is = new FileInputStream(file); try { byte[] data = new byte[(int)fileSize]; byte[] buff = new byte[ValueFileIOHelper.IOBUFFER_SIZE > fileSize ? ValueFileIOHelper.IOBUFFER_SIZE : (int)fileSize]; int rpos = 0; int read; while ((read = is.read(buff)) >= 0) { System.arraycopy(buff, 0, data, rpos, read); // depends on control dependency: [while], data = [none] rpos += read; // depends on control dependency: [while], data = [none] } vdDataWrapper.value = createValueData(type, orderNumber, data); // depends on control dependency: [try], data = [none] } finally { is.close(); } } return vdDataWrapper; } }
public class class_name { public static boolean needHttpDns() { try { TimeZone zone = TimeZone.getDefault(); String id = zone.getID(); return ("Asia/Shanghai".equals(id) || "Asia/Chongqing".equals(id) || "Asia/Harbin".equals(id) || "Asia/Urumqi".equals(id)); } catch (Exception e) { return false; } } }
public class class_name { public static boolean needHttpDns() { try { TimeZone zone = TimeZone.getDefault(); String id = zone.getID(); return ("Asia/Shanghai".equals(id) || "Asia/Chongqing".equals(id) || "Asia/Harbin".equals(id) || "Asia/Urumqi".equals(id)); // depends on control dependency: [try], data = [none] } catch (Exception e) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Predicate and(Predicate left, Predicate right) { left = (Predicate) extract(left); right = (Predicate) extract(right); if (left == null) { return right; } else if (right == null) { return left; } else { return predicate(Ops.AND, left, right); } } }
public class class_name { public static Predicate and(Predicate left, Predicate right) { left = (Predicate) extract(left); right = (Predicate) extract(right); if (left == null) { return right; // depends on control dependency: [if], data = [none] } else if (right == null) { return left; // depends on control dependency: [if], data = [none] } else { return predicate(Ops.AND, left, right); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public int compareTo(final ModuleInfo other) { final int diff = this.name.compareTo(other.name); if (diff != 0) { return diff; } final URI thisLoc = this.getLocation(); final URI otherLoc = other.getLocation(); if (thisLoc != null && otherLoc != null) { return thisLoc.compareTo(otherLoc); } return 0; } }
public class class_name { @Override public int compareTo(final ModuleInfo other) { final int diff = this.name.compareTo(other.name); if (diff != 0) { return diff; // depends on control dependency: [if], data = [none] } final URI thisLoc = this.getLocation(); final URI otherLoc = other.getLocation(); if (thisLoc != null && otherLoc != null) { return thisLoc.compareTo(otherLoc); // depends on control dependency: [if], data = [none] } return 0; } }
public class class_name { @Override public synchronized WComponent getUI(final String key) { WComponent ui = registry.get(key); if (ui == null) { // Looks like we haven't tried loading this UI yet, so do it now. ui = loadUI(key); ui.setLocked(true); // Cache the result only if the UI was successfully loaded. if (ui instanceof ErrorPage) { LOG.debug("Returning non-cached ErrorPage WComponent. Key=" + key); } else { register(key, ui); LOG.debug("Returning cached WComponent. Key=" + key); } } else { LOG.debug("Returning cached WComponent. Key=" + key); } return ui; } }
public class class_name { @Override public synchronized WComponent getUI(final String key) { WComponent ui = registry.get(key); if (ui == null) { // Looks like we haven't tried loading this UI yet, so do it now. ui = loadUI(key); // depends on control dependency: [if], data = [none] ui.setLocked(true); // depends on control dependency: [if], data = [none] // Cache the result only if the UI was successfully loaded. if (ui instanceof ErrorPage) { LOG.debug("Returning non-cached ErrorPage WComponent. Key=" + key); // depends on control dependency: [if], data = [none] } else { register(key, ui); // depends on control dependency: [if], data = [none] LOG.debug("Returning cached WComponent. Key=" + key); // depends on control dependency: [if], data = [none] } } else { LOG.debug("Returning cached WComponent. Key=" + key); // depends on control dependency: [if], data = [none] } return ui; } }
public class class_name { public static base_responses delete(nitro_service client, String metrictable[]) throws Exception { base_responses result = null; if (metrictable != null && metrictable.length > 0) { lbmetrictable deleteresources[] = new lbmetrictable[metrictable.length]; for (int i=0;i<metrictable.length;i++){ deleteresources[i] = new lbmetrictable(); deleteresources[i].metrictable = metrictable[i]; } result = delete_bulk_request(client, deleteresources); } return result; } }
public class class_name { public static base_responses delete(nitro_service client, String metrictable[]) throws Exception { base_responses result = null; if (metrictable != null && metrictable.length > 0) { lbmetrictable deleteresources[] = new lbmetrictable[metrictable.length]; for (int i=0;i<metrictable.length;i++){ deleteresources[i] = new lbmetrictable(); // depends on control dependency: [for], data = [i] deleteresources[i].metrictable = metrictable[i]; // depends on control dependency: [for], data = [i] } result = delete_bulk_request(client, deleteresources); } return result; } }
public class class_name { public List<String> encode(Collection<? extends Cookie> cookies) { if (checkNotNull(cookies, "cookies").isEmpty()) { return Collections.emptyList(); } List<String> encoded = new ArrayList<String>(cookies.size()); Map<String, Integer> nameToIndex = strict && cookies.size() > 1 ? new HashMap<String, Integer>() : null; int i = 0; boolean hasDupdName = false; for (Cookie c : cookies) { encoded.add(encode(c)); if (nameToIndex != null) { hasDupdName |= nameToIndex.put(c.name(), i++) != null; } } return hasDupdName ? dedup(encoded, nameToIndex) : encoded; } }
public class class_name { public List<String> encode(Collection<? extends Cookie> cookies) { if (checkNotNull(cookies, "cookies").isEmpty()) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } List<String> encoded = new ArrayList<String>(cookies.size()); Map<String, Integer> nameToIndex = strict && cookies.size() > 1 ? new HashMap<String, Integer>() : null; int i = 0; boolean hasDupdName = false; for (Cookie c : cookies) { encoded.add(encode(c)); // depends on control dependency: [for], data = [c] if (nameToIndex != null) { hasDupdName |= nameToIndex.put(c.name(), i++) != null; // depends on control dependency: [if], data = [none] } } return hasDupdName ? dedup(encoded, nameToIndex) : encoded; } }
public class class_name { public boolean containLogsFrom(LogLevel level) { for (LogEvent log : this) { if (log.getLevel().compareTo(level) <= 0) { return true; } } return false; } }
public class class_name { public boolean containLogsFrom(LogLevel level) { for (LogEvent log : this) { if (log.getLevel().compareTo(level) <= 0) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { @SuppressWarnings("unchecked") public static <T> T enhance(final ClassLoader loader, Object instance, ForgeProxy handler) { Assert.notNull(loader, "ClassLoader must not be null"); Assert.notNull(handler, "ForgeProxy handler must not be null"); if (instance == null) return null; Class<?> type = Proxies.unwrapProxyTypes(instance.getClass(), loader); Object result = null; Class<?> proxyType = getCachedProxyType(loader, type); if (proxyType == null) { Class<?>[] hierarchy = null; Class<?> superclass = null; hierarchy = ProxyTypeInspector.getCompatibleClassHierarchy(loader, type); if (hierarchy == null || hierarchy.length == 0) throw new IllegalArgumentException("Must specify at least one non-final type to enhance for Object: " + instance + " of type " + instance.getClass()); Class<?> first = hierarchy[0]; if (!first.isInterface() && !isProxyType(first)) { superclass = Proxies.unwrapProxyTypes(first, loader); hierarchy = Arrays.shiftLeft(hierarchy, new Class<?>[hierarchy.length - 1]); } else if (isProxyType(first)) hierarchy = Arrays.shiftLeft(hierarchy, new Class<?>[hierarchy.length - 1]); int index = Arrays.indexOf(hierarchy, ProxyObject.class); if (index >= 0) { hierarchy = Arrays.removeElementAtIndex(hierarchy, index); } if (!Proxies.isProxyType(first) && !Arrays.contains(hierarchy, ForgeProxy.class)) hierarchy = Arrays.append(hierarchy, ForgeProxy.class); ProxyFactory f = new ProxyFactory() { @Override protected ClassLoader getClassLoader() { return loader; } }; f.setInterfaces(hierarchy); f.setSuperclass(superclass); f.setFilter(filter); proxyType = f.createClass(); setCachedProxyType(loader, type, proxyType); } try { result = proxyType.getDeclaredConstructor().newInstance(); } catch (InstantiationException e) { throw new IllegalStateException( "Could not instantiate proxy for object [" + instance + "] of type [" + type + "]. For optimal proxy compatibility, ensure " + "that this type is an interface, or a class with a default constructor.", e); } catch (NoSuchMethodException e) { throw new IllegalStateException( "Could not instantiate proxy for object [" + instance + "] of type [" + type + "] because there isn't a public default constructor. For optimal proxy compatibility, " + "ensure that this type is an interface, or a class with a default constructor.", e); } catch (IllegalAccessException | InvocationTargetException e) { throw new IllegalStateException(e); } if (result instanceof Proxy) ((Proxy) result).setHandler(handler); else if (result instanceof ProxyObject) ((ProxyObject) result).setHandler(handler); else throw new IllegalStateException("Could not set proxy handler [" + handler + "] for proxy object [" + result + "] for instance object [" + instance + "] of type [" + instance.getClass() + "]"); return (T) result; } }
public class class_name { @SuppressWarnings("unchecked") public static <T> T enhance(final ClassLoader loader, Object instance, ForgeProxy handler) { Assert.notNull(loader, "ClassLoader must not be null"); Assert.notNull(handler, "ForgeProxy handler must not be null"); if (instance == null) return null; Class<?> type = Proxies.unwrapProxyTypes(instance.getClass(), loader); Object result = null; Class<?> proxyType = getCachedProxyType(loader, type); if (proxyType == null) { Class<?>[] hierarchy = null; // depends on control dependency: [if], data = [none] Class<?> superclass = null; // depends on control dependency: [if], data = [none] hierarchy = ProxyTypeInspector.getCompatibleClassHierarchy(loader, type); // depends on control dependency: [if], data = [none] if (hierarchy == null || hierarchy.length == 0) throw new IllegalArgumentException("Must specify at least one non-final type to enhance for Object: " + instance + " of type " + instance.getClass()); Class<?> first = hierarchy[0]; if (!first.isInterface() && !isProxyType(first)) { superclass = Proxies.unwrapProxyTypes(first, loader); // depends on control dependency: [if], data = [none] hierarchy = Arrays.shiftLeft(hierarchy, new Class<?>[hierarchy.length - 1]); // depends on control dependency: [if], data = [none] } else if (isProxyType(first)) hierarchy = Arrays.shiftLeft(hierarchy, new Class<?>[hierarchy.length - 1]); int index = Arrays.indexOf(hierarchy, ProxyObject.class); if (index >= 0) { hierarchy = Arrays.removeElementAtIndex(hierarchy, index); // depends on control dependency: [if], data = [none] } if (!Proxies.isProxyType(first) && !Arrays.contains(hierarchy, ForgeProxy.class)) hierarchy = Arrays.append(hierarchy, ForgeProxy.class); ProxyFactory f = new ProxyFactory() { @Override protected ClassLoader getClassLoader() { return loader; } }; f.setInterfaces(hierarchy); // depends on control dependency: [if], data = [none] f.setSuperclass(superclass); // depends on control dependency: [if], data = [none] f.setFilter(filter); // depends on control dependency: [if], data = [none] proxyType = f.createClass(); // depends on control dependency: [if], data = [none] setCachedProxyType(loader, type, proxyType); // depends on control dependency: [if], data = [none] } try { result = proxyType.getDeclaredConstructor().newInstance(); // depends on control dependency: [try], data = [none] } catch (InstantiationException e) { throw new IllegalStateException( "Could not instantiate proxy for object [" + instance + "] of type [" + type + "]. For optimal proxy compatibility, ensure " + "that this type is an interface, or a class with a default constructor.", e); } // depends on control dependency: [catch], data = [none] catch (NoSuchMethodException e) { throw new IllegalStateException( "Could not instantiate proxy for object [" + instance + "] of type [" + type + "] because there isn't a public default constructor. For optimal proxy compatibility, " + "ensure that this type is an interface, or a class with a default constructor.", e); } // depends on control dependency: [catch], data = [none] catch (IllegalAccessException | InvocationTargetException e) { throw new IllegalStateException(e); } // depends on control dependency: [catch], data = [none] if (result instanceof Proxy) ((Proxy) result).setHandler(handler); else if (result instanceof ProxyObject) ((ProxyObject) result).setHandler(handler); else throw new IllegalStateException("Could not set proxy handler [" + handler + "] for proxy object [" + result + "] for instance object [" + instance + "] of type [" + instance.getClass() + "]"); return (T) result; } }
public class class_name { protected static void registerGraphiteMetricObserver(List<MetricObserver> observers, String prefix, String host, String port) { // verify at least hostname is set, else cannot configure this observer if (null == host || host.trim().isEmpty()) { LOGGER.info("GraphiteMetricObserver not configured, missing environment variable: {}", ENV_GRAPHITE_HOSTNAME); return; } LOGGER.debug("{} environment variable is: {}", ENV_GRAPHITE_PREFIX, prefix); LOGGER.debug("{} environment variable is: {}", ENV_GRAPHITE_HOSTNAME, host); LOGGER.debug("{} environment variable is: {}", ENV_GRAPHITE_PORT, port); if (prefix == null) { if (System.getenv("OPENSHIFT_APP_NAME") != null) { // try to get name from openshift. assume it's scaleable app. // format: <app name>. <namespace>.<gear dns> prefix = String.format( "%s.%s.%s", System.getenv("OPENSHIFT_APP_NAME"), System.getenv("OPENSHIFT_NAMESPACE"), System.getenv("OPENSHIFT_GEAR_DNS") ); } else { //default prefix = System.getenv("HOSTNAME"); LOGGER.debug("using HOSTNAME as default prefix" + prefix); } } int iport = -1; if (port != null && !port.isEmpty()) { try { iport = Integer.valueOf(port); } catch (NumberFormatException e) { iport = -1; LOGGER.warn("Configured port is not an integer. Falling back to default"); } } if (iport < 0) { iport = 2004; //default graphite port LOGGER.debug("Using default port: " + iport); } String addr = host + ":" + iport; LOGGER.debug("GraphiteMetricObserver prefix: " + prefix); LOGGER.debug("GraphiteMetricObserver address: " + addr); observers.add(new GraphiteMetricObserver(prefix, addr)); } }
public class class_name { protected static void registerGraphiteMetricObserver(List<MetricObserver> observers, String prefix, String host, String port) { // verify at least hostname is set, else cannot configure this observer if (null == host || host.trim().isEmpty()) { LOGGER.info("GraphiteMetricObserver not configured, missing environment variable: {}", ENV_GRAPHITE_HOSTNAME); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } LOGGER.debug("{} environment variable is: {}", ENV_GRAPHITE_PREFIX, prefix); LOGGER.debug("{} environment variable is: {}", ENV_GRAPHITE_HOSTNAME, host); LOGGER.debug("{} environment variable is: {}", ENV_GRAPHITE_PORT, port); if (prefix == null) { if (System.getenv("OPENSHIFT_APP_NAME") != null) { // try to get name from openshift. assume it's scaleable app. // format: <app name>. <namespace>.<gear dns> prefix = String.format( "%s.%s.%s", System.getenv("OPENSHIFT_APP_NAME"), System.getenv("OPENSHIFT_NAMESPACE"), System.getenv("OPENSHIFT_GEAR_DNS") ); // depends on control dependency: [if], data = [none] } else { //default prefix = System.getenv("HOSTNAME"); // depends on control dependency: [if], data = [none] LOGGER.debug("using HOSTNAME as default prefix" + prefix); // depends on control dependency: [if], data = [none] } } int iport = -1; if (port != null && !port.isEmpty()) { try { iport = Integer.valueOf(port); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { iport = -1; LOGGER.warn("Configured port is not an integer. Falling back to default"); } // depends on control dependency: [catch], data = [none] } if (iport < 0) { iport = 2004; //default graphite port // depends on control dependency: [if], data = [none] LOGGER.debug("Using default port: " + iport); // depends on control dependency: [if], data = [none] } String addr = host + ":" + iport; LOGGER.debug("GraphiteMetricObserver prefix: " + prefix); LOGGER.debug("GraphiteMetricObserver address: " + addr); observers.add(new GraphiteMetricObserver(prefix, addr)); } }
public class class_name { protected void updateStateEndDocument() throws XMLStreamException { if (mCfgMultiDocMode) { // As per [woodstox-core#42] should allow reading over multiple documents... if (mReader.hasNext()) { // Let's sanity-check that we get token we expect however: int next = mReader.next(); if (next == START_DOCUMENT) { mPrePeekEvent = START_DOCUMENT; mPeekedEvent = createStartDocumentEvent(); mState = STATE_CONTENT; return; } reportProblem("Unexpected token ("+ErrorConsts.tokenTypeDesc(next) +") after END_DOCUMENT in multi-document mode, XMLStreamReader.hasNext() returning true"); } } mState = STATE_END_OF_INPUT; } }
public class class_name { protected void updateStateEndDocument() throws XMLStreamException { if (mCfgMultiDocMode) { // As per [woodstox-core#42] should allow reading over multiple documents... if (mReader.hasNext()) { // Let's sanity-check that we get token we expect however: int next = mReader.next(); if (next == START_DOCUMENT) { mPrePeekEvent = START_DOCUMENT; // depends on control dependency: [if], data = [none] mPeekedEvent = createStartDocumentEvent(); // depends on control dependency: [if], data = [none] mState = STATE_CONTENT; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } reportProblem("Unexpected token ("+ErrorConsts.tokenTypeDesc(next) +") after END_DOCUMENT in multi-document mode, XMLStreamReader.hasNext() returning true"); // depends on control dependency: [if], data = [none] } } mState = STATE_END_OF_INPUT; } }
public class class_name { public void slideHorizontally(float slideOffset, float drawerPosition, int width) { if (slideOffset > MIN_SLIDE_OFFSET && !isClosed() && isMaximized()) { minimize(); } setTouchEnabled(slideOffset <= MIN_SLIDE_OFFSET); ViewHelper.setX(this, width - Math.abs(drawerPosition)); } }
public class class_name { public void slideHorizontally(float slideOffset, float drawerPosition, int width) { if (slideOffset > MIN_SLIDE_OFFSET && !isClosed() && isMaximized()) { minimize(); // depends on control dependency: [if], data = [none] } setTouchEnabled(slideOffset <= MIN_SLIDE_OFFSET); ViewHelper.setX(this, width - Math.abs(drawerPosition)); } }
public class class_name { @Override public JobStatus getJobStatus(final JobId jobId) { final ZooKeeperClient client = provider.get("getJobStatus"); final Job job = getJob(client, jobId); if (job == null) { return null; } final List<String> hosts; try { hosts = listJobHosts(client, jobId); } catch (JobDoesNotExistException e) { return null; } final ImmutableMap.Builder<String, Deployment> deployments = ImmutableMap.builder(); final ImmutableMap.Builder<String, TaskStatus> taskStatuses = ImmutableMap.builder(); for (final String host : hosts) { final TaskStatus taskStatus = getTaskStatus(client, host, jobId); if (taskStatus != null) { taskStatuses.put(host, taskStatus); } final Deployment deployment = getDeployment(host, jobId); if (deployment != null) { deployments.put(host, deployment); } } final Map<String, Deployment> deploymentsMap = deployments.build(); return JobStatus.newBuilder() .setJob(job) .setDeployments(deploymentsMap) .setTaskStatuses(taskStatuses.build()) .build(); } }
public class class_name { @Override public JobStatus getJobStatus(final JobId jobId) { final ZooKeeperClient client = provider.get("getJobStatus"); final Job job = getJob(client, jobId); if (job == null) { return null; // depends on control dependency: [if], data = [none] } final List<String> hosts; try { hosts = listJobHosts(client, jobId); // depends on control dependency: [try], data = [none] } catch (JobDoesNotExistException e) { return null; } // depends on control dependency: [catch], data = [none] final ImmutableMap.Builder<String, Deployment> deployments = ImmutableMap.builder(); final ImmutableMap.Builder<String, TaskStatus> taskStatuses = ImmutableMap.builder(); for (final String host : hosts) { final TaskStatus taskStatus = getTaskStatus(client, host, jobId); if (taskStatus != null) { taskStatuses.put(host, taskStatus); // depends on control dependency: [if], data = [none] } final Deployment deployment = getDeployment(host, jobId); if (deployment != null) { deployments.put(host, deployment); // depends on control dependency: [if], data = [none] } } final Map<String, Deployment> deploymentsMap = deployments.build(); return JobStatus.newBuilder() .setJob(job) .setDeployments(deploymentsMap) .setTaskStatuses(taskStatuses.build()) .build(); } }
public class class_name { @Override public boolean add(ClientPresentationModel model) { boolean success = super.add(model); if (success) { List<ClientAttribute> attributes = model.getAttributes(); for (ClientAttribute attribute : attributes) { attribute.addPropertyChangeListener(attributeChangeListener); } if (!model.isClientSideOnly()) { getClientConnector().send(CreatePresentationModelCommand.makeFrom(model)); } } return success; } }
public class class_name { @Override public boolean add(ClientPresentationModel model) { boolean success = super.add(model); if (success) { List<ClientAttribute> attributes = model.getAttributes(); for (ClientAttribute attribute : attributes) { attribute.addPropertyChangeListener(attributeChangeListener); // depends on control dependency: [for], data = [attribute] } if (!model.isClientSideOnly()) { getClientConnector().send(CreatePresentationModelCommand.makeFrom(model)); // depends on control dependency: [if], data = [none] } } return success; } }
public class class_name { public String replace(CharSequence text, CharSequence replacement) { try { if (text.length() == 0) { if (acceptEmpty) { return ""; } } CharArrayWriter caw = new CharArrayWriter(); InputReader reader = Input.getInstance(text); ObsoleteSimpleReplacer fsp = new ObsoleteSimpleReplacer(replacement); replace(reader, caw, fsp); return caw.toString(); } catch (IOException ex) { throw new IllegalArgumentException("can't happen", ex); } } }
public class class_name { public String replace(CharSequence text, CharSequence replacement) { try { if (text.length() == 0) { if (acceptEmpty) { return ""; // depends on control dependency: [if], data = [none] } } CharArrayWriter caw = new CharArrayWriter(); InputReader reader = Input.getInstance(text); ObsoleteSimpleReplacer fsp = new ObsoleteSimpleReplacer(replacement); replace(reader, caw, fsp); // depends on control dependency: [try], data = [none] return caw.toString(); // depends on control dependency: [try], data = [none] } catch (IOException ex) { throw new IllegalArgumentException("can't happen", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static @Nonnull List<ThreadLock.Monitor> getMonitors(final ThreadInfo threadInfo) { final MonitorInfo[] monitors = threadInfo.getLockedMonitors(); final List<ThreadLock.Monitor> locks = new ArrayList<ThreadLock.Monitor>(monitors.length); for (MonitorInfo info: monitors) { locks.add(getMonitor(info)); } return locks; } }
public class class_name { static @Nonnull List<ThreadLock.Monitor> getMonitors(final ThreadInfo threadInfo) { final MonitorInfo[] monitors = threadInfo.getLockedMonitors(); final List<ThreadLock.Monitor> locks = new ArrayList<ThreadLock.Monitor>(monitors.length); for (MonitorInfo info: monitors) { locks.add(getMonitor(info)); // depends on control dependency: [for], data = [info] } return locks; } }
public class class_name { public static Object convert(final String value, final Class<?> type) { final Object result; if (value == null) { result = null; } else if (type.isPrimitive()) { result = toPrimitive(value, type); } else if (OBJECT_TO_PRIMITIVE_TYPE_MAP.containsKey(type)) { result = valueOf(value, type); } else { result = value; } return result; } }
public class class_name { public static Object convert(final String value, final Class<?> type) { final Object result; if (value == null) { result = null; // depends on control dependency: [if], data = [none] } else if (type.isPrimitive()) { result = toPrimitive(value, type); // depends on control dependency: [if], data = [none] } else if (OBJECT_TO_PRIMITIVE_TYPE_MAP.containsKey(type)) { result = valueOf(value, type); // depends on control dependency: [if], data = [none] } else { result = value; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { private void parseMap( Field fieldContext, Map<String, Object> destinationMap, Type valueType, ArrayList<Type> context, CustomizeJsonParser customizeParser) throws IOException { JsonToken curToken = startParsingObjectOrArray(); while (curToken == JsonToken.FIELD_NAME) { String key = getText(); nextToken(); // stop at items for feeds if (customizeParser != null && customizeParser.stopAt(destinationMap, key)) { return; } Object value = parseValue(fieldContext, valueType, context, destinationMap, customizeParser, true); destinationMap.put(key, value); curToken = nextToken(); } } }
public class class_name { private void parseMap( Field fieldContext, Map<String, Object> destinationMap, Type valueType, ArrayList<Type> context, CustomizeJsonParser customizeParser) throws IOException { JsonToken curToken = startParsingObjectOrArray(); while (curToken == JsonToken.FIELD_NAME) { String key = getText(); nextToken(); // stop at items for feeds if (customizeParser != null && customizeParser.stopAt(destinationMap, key)) { return; // depends on control dependency: [if], data = [none] } Object value = parseValue(fieldContext, valueType, context, destinationMap, customizeParser, true); destinationMap.put(key, value); curToken = nextToken(); } } }
public class class_name { public void end() { ProfilingTimerNode currentNode = current.get(); if (currentNode != null) { currentNode.stop(); current.set(currentNode.parent); } } }
public class class_name { public void end() { ProfilingTimerNode currentNode = current.get(); if (currentNode != null) { currentNode.stop(); // depends on control dependency: [if], data = [none] current.set(currentNode.parent); // depends on control dependency: [if], data = [(currentNode] } } }
public class class_name { public List<Object> closePipeline() { if (pipeline == null) { return Collections.emptyList(); } try { return convertPipelineResults(); } finally { pipeline.close(); pipeline = null; pipelinedResults.clear(); } } }
public class class_name { public List<Object> closePipeline() { if (pipeline == null) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } try { return convertPipelineResults(); // depends on control dependency: [try], data = [none] } finally { pipeline.close(); pipeline = null; pipelinedResults.clear(); } } }
public class class_name { protected static void removeRedundantArcs(int row, int column, List<Integer> marcs, McgregorHelper mcGregorHelper) { int neighborBondNumA = mcGregorHelper.getNeighborBondNumA(); int neighborBondNumB = mcGregorHelper.getNeighborBondNumB(); List<Integer> iBondNeighborAtomsA = mcGregorHelper.getiBondNeighborAtomsA(); List<Integer> iBondNeighborAtomsB = mcGregorHelper.getiBondNeighborAtomsB(); int g1Atom = iBondNeighborAtomsA.get(row * 3 + 0); int g2Atom = iBondNeighborAtomsA.get(row * 3 + 1); int g3Atom = iBondNeighborAtomsB.get(column * 3 + 0); int g4Atom = iBondNeighborAtomsB.get(column * 3 + 1); for (int x = 0; x < neighborBondNumA; x++) { int rowAtom1 = iBondNeighborAtomsA.get(x * 3 + 0); int rowAtom2 = iBondNeighborAtomsA.get(x * 3 + 1); for (int y = 0; y < neighborBondNumB; y++) { int columnAtom3 = iBondNeighborAtomsB.get(y * 3 + 0); int columnAtom4 = iBondNeighborAtomsB.get(y * 3 + 1); if (McGregorChecks.cases(g1Atom, g2Atom, g3Atom, g4Atom, rowAtom1, rowAtom2, columnAtom3, columnAtom4)) { marcs.set(x * neighborBondNumB + y, 0); } } } for (int v = 0; v < neighborBondNumA; v++) { marcs.set(v * neighborBondNumB + column, 0); } for (int w = 0; w < neighborBondNumB; w++) { marcs.set(row * neighborBondNumB + w, 0); } marcs.set(row * neighborBondNumB + column, 1); } }
public class class_name { protected static void removeRedundantArcs(int row, int column, List<Integer> marcs, McgregorHelper mcGregorHelper) { int neighborBondNumA = mcGregorHelper.getNeighborBondNumA(); int neighborBondNumB = mcGregorHelper.getNeighborBondNumB(); List<Integer> iBondNeighborAtomsA = mcGregorHelper.getiBondNeighborAtomsA(); List<Integer> iBondNeighborAtomsB = mcGregorHelper.getiBondNeighborAtomsB(); int g1Atom = iBondNeighborAtomsA.get(row * 3 + 0); int g2Atom = iBondNeighborAtomsA.get(row * 3 + 1); int g3Atom = iBondNeighborAtomsB.get(column * 3 + 0); int g4Atom = iBondNeighborAtomsB.get(column * 3 + 1); for (int x = 0; x < neighborBondNumA; x++) { int rowAtom1 = iBondNeighborAtomsA.get(x * 3 + 0); int rowAtom2 = iBondNeighborAtomsA.get(x * 3 + 1); for (int y = 0; y < neighborBondNumB; y++) { int columnAtom3 = iBondNeighborAtomsB.get(y * 3 + 0); int columnAtom4 = iBondNeighborAtomsB.get(y * 3 + 1); if (McGregorChecks.cases(g1Atom, g2Atom, g3Atom, g4Atom, rowAtom1, rowAtom2, columnAtom3, columnAtom4)) { marcs.set(x * neighborBondNumB + y, 0); // depends on control dependency: [if], data = [none] } } } for (int v = 0; v < neighborBondNumA; v++) { marcs.set(v * neighborBondNumB + column, 0); // depends on control dependency: [for], data = [v] } for (int w = 0; w < neighborBondNumB; w++) { marcs.set(row * neighborBondNumB + w, 0); // depends on control dependency: [for], data = [w] } marcs.set(row * neighborBondNumB + column, 1); } }
public class class_name { private void sendNotification(String errMessage, int errCode, String errType, boolean createNotification) { NotificationsDao notifications = storage.getNotificationsDao(); Notification notification; if (errType == "warning") { logger.warning(errMessage); // send message to console if (createNotification) { notification = notification(WARNING_NOTIFICATION, errCode, errMessage); notifications.addNotification(notification); } } else if (errType == "error") { logger.error(errMessage); // send message to console if (createNotification) { notification = notification(ERROR_NOTIFICATION, errCode, errMessage); notifications.addNotification(notification); } } else if (errType == "info") { if (logger.isInfoEnabled()) { logger.info(errMessage); // send message to console } } } }
public class class_name { private void sendNotification(String errMessage, int errCode, String errType, boolean createNotification) { NotificationsDao notifications = storage.getNotificationsDao(); Notification notification; if (errType == "warning") { logger.warning(errMessage); // send message to console // depends on control dependency: [if], data = [none] if (createNotification) { notification = notification(WARNING_NOTIFICATION, errCode, errMessage); // depends on control dependency: [if], data = [none] notifications.addNotification(notification); // depends on control dependency: [if], data = [none] } } else if (errType == "error") { logger.error(errMessage); // send message to console // depends on control dependency: [if], data = [none] if (createNotification) { notification = notification(ERROR_NOTIFICATION, errCode, errMessage); // depends on control dependency: [if], data = [none] notifications.addNotification(notification); // depends on control dependency: [if], data = [none] } } else if (errType == "info") { if (logger.isInfoEnabled()) { logger.info(errMessage); // send message to console // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static void horizontal(Kernel1D_F32 kernel, InterleavedF32 src, InterleavedF32 dst ) { InputSanityCheck.checkSameShapeB(src, dst); boolean processed = BOverrideConvolveImageNormalized.invokeNativeHorizontal(kernel,src,dst); if( !processed ) { if( kernel.width >= src.width ) { ConvolveNormalizedNaive_IL.horizontal(kernel,src,dst); } else { if( Math.abs(kernel.computeSum() - 1.0f) > 1e-4f ) { Kernel1D_F32 k = kernel.copy(); KernelMath.normalizeSumToOne(k); kernel = k; } ConvolveImageNoBorder.horizontal(kernel,src,dst); ConvolveNormalized_JustBorder_IL.horizontal(kernel,src,dst); } } } }
public class class_name { public static void horizontal(Kernel1D_F32 kernel, InterleavedF32 src, InterleavedF32 dst ) { InputSanityCheck.checkSameShapeB(src, dst); boolean processed = BOverrideConvolveImageNormalized.invokeNativeHorizontal(kernel,src,dst); if( !processed ) { if( kernel.width >= src.width ) { ConvolveNormalizedNaive_IL.horizontal(kernel,src,dst); // depends on control dependency: [if], data = [none] } else { if( Math.abs(kernel.computeSum() - 1.0f) > 1e-4f ) { Kernel1D_F32 k = kernel.copy(); KernelMath.normalizeSumToOne(k); // depends on control dependency: [if], data = [none] kernel = k; // depends on control dependency: [if], data = [none] } ConvolveImageNoBorder.horizontal(kernel,src,dst); // depends on control dependency: [if], data = [none] ConvolveNormalized_JustBorder_IL.horizontal(kernel,src,dst); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(DeleteVPCEConfigurationRequest deleteVPCEConfigurationRequest, ProtocolMarshaller protocolMarshaller) { if (deleteVPCEConfigurationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteVPCEConfigurationRequest.getArn(), ARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteVPCEConfigurationRequest deleteVPCEConfigurationRequest, ProtocolMarshaller protocolMarshaller) { if (deleteVPCEConfigurationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteVPCEConfigurationRequest.getArn(), ARN_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 final EObject entryRuleContinueExpression() throws RecognitionException { EObject current = null; EObject iv_ruleContinueExpression = null; try { // InternalSARL.g:7479:59: (iv_ruleContinueExpression= ruleContinueExpression EOF ) // InternalSARL.g:7480:2: iv_ruleContinueExpression= ruleContinueExpression EOF { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getContinueExpressionRule()); } pushFollow(FOLLOW_1); iv_ruleContinueExpression=ruleContinueExpression(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current =iv_ruleContinueExpression; } match(input,EOF,FOLLOW_2); if (state.failed) return current; } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public final EObject entryRuleContinueExpression() throws RecognitionException { EObject current = null; EObject iv_ruleContinueExpression = null; try { // InternalSARL.g:7479:59: (iv_ruleContinueExpression= ruleContinueExpression EOF ) // InternalSARL.g:7480:2: iv_ruleContinueExpression= ruleContinueExpression EOF { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getContinueExpressionRule()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_1); iv_ruleContinueExpression=ruleContinueExpression(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current =iv_ruleContinueExpression; // depends on control dependency: [if], data = [none] } match(input,EOF,FOLLOW_2); if (state.failed) return current; } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { @Override protected Object doExec(Element element, Object scope, String propertyPath, Object... arguments) throws TemplateException { if (!propertyPath.equals(".") && ConverterRegistry.hasType(scope.getClass())) { throw new TemplateException("Operand is property path but scope is not an object."); } Object value = content.getObject(scope, propertyPath); if (value == null) { return null; } if (Types.isNumber(value)) { value = value.toString(); } if (Types.isEnum(value)) { value = ((Enum<?>) value).name(); } if (!(value instanceof String)) { throw new TemplateException("Invalid element |%s|. ID operand should be string, enumeration or numeric.", element); } return new AttrImpl("id", (String) value); } }
public class class_name { @Override protected Object doExec(Element element, Object scope, String propertyPath, Object... arguments) throws TemplateException { if (!propertyPath.equals(".") && ConverterRegistry.hasType(scope.getClass())) { throw new TemplateException("Operand is property path but scope is not an object."); } Object value = content.getObject(scope, propertyPath); if (value == null) { return null; // depends on control dependency: [if], data = [none] } if (Types.isNumber(value)) { value = value.toString(); // depends on control dependency: [if], data = [none] } if (Types.isEnum(value)) { value = ((Enum<?>) value).name(); // depends on control dependency: [if], data = [none] } if (!(value instanceof String)) { throw new TemplateException("Invalid element |%s|. ID operand should be string, enumeration or numeric.", element); } return new AttrImpl("id", (String) value); } }
public class class_name { public static String nameEncode(String value) { if (value == null) return null; // make buffer roomy StringBuilder encodedValue = new StringBuilder(value.length() * 2); int length = value.length(); int last = length - 1; for (int i = 0; i < length; i++) { char c = value.charAt(i); // space first or last if (c == ' ' && (i == 0 || i == last)) { encodedValue.append("\\ "); continue; } if (c < NAME_ESCAPE_TABLE.length) { // check in table for escapes String esc = NAME_ESCAPE_TABLE[c]; if (esc != null) { encodedValue.append(esc); continue; } } // default: add the char encodedValue.append(c); } return encodedValue.toString(); } }
public class class_name { public static String nameEncode(String value) { if (value == null) return null; // make buffer roomy StringBuilder encodedValue = new StringBuilder(value.length() * 2); int length = value.length(); int last = length - 1; for (int i = 0; i < length; i++) { char c = value.charAt(i); // space first or last if (c == ' ' && (i == 0 || i == last)) { encodedValue.append("\\ "); // depends on control dependency: [if], data = [none] continue; } if (c < NAME_ESCAPE_TABLE.length) { // check in table for escapes String esc = NAME_ESCAPE_TABLE[c]; if (esc != null) { encodedValue.append(esc); // depends on control dependency: [if], data = [(esc] continue; } } // default: add the char encodedValue.append(c); // depends on control dependency: [for], data = [none] } return encodedValue.toString(); } }
public class class_name { public void removeExtension() { try { if (extensionsDao.isTableExists()) { extensionsDao.deleteByExtension(EXTENSION_NAME); } } catch (SQLException e) { throw new GeoPackageException( "Failed to delete CRS WKT extension. GeoPackage: " + geoPackage.getName(), e); } } }
public class class_name { public void removeExtension() { try { if (extensionsDao.isTableExists()) { extensionsDao.deleteByExtension(EXTENSION_NAME); // depends on control dependency: [if], data = [none] } } catch (SQLException e) { throw new GeoPackageException( "Failed to delete CRS WKT extension. GeoPackage: " + geoPackage.getName(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private List<String> getDynamicMembers(Attribute groupMemberURLs) throws WIMException { final String METHODNAME = "getDynamicMembers"; List<String> memberDNs = new ArrayList<String>(); if (groupMemberURLs != null) { try { for (NamingEnumeration<?> enu = groupMemberURLs.getAll(); enu.hasMoreElements();) { String ldapurlStr = (String) (enu.nextElement()); if (ldapurlStr != null) { LdapURL ldapURL = new LdapURL(ldapurlStr); if (ldapURL.parsedOK()) { int searchScope = SearchControls.OBJECT_SCOPE; String scopeBuf = ldapURL.get_scope(); if (scopeBuf != null) { if (scopeBuf.compareToIgnoreCase("base") == 0) { searchScope = SearchControls.OBJECT_SCOPE; } else if (scopeBuf.compareToIgnoreCase("one") == 0) { searchScope = SearchControls.ONELEVEL_SCOPE; } else if (scopeBuf.compareToIgnoreCase("sub") == 0) { searchScope = SearchControls.SUBTREE_SCOPE; } } String searchFilter = ldapURL.get_filter(); if (searchFilter == null) { searchFilter = "(objectClass=*)"; } String searchBase = ldapURL.get_dn(); String[] attributesToReturn = ldapURL.get_attributes(); for (NamingEnumeration<?> nenu = iLdapConn.search(searchBase, searchFilter, searchScope, attributesToReturn); nenu.hasMoreElements();) { javax.naming.directory.SearchResult thisEntry = (javax.naming.directory.SearchResult) nenu.nextElement(); if (thisEntry == null) { continue; } String dynaMbrDN = LdapHelper.prepareDN(thisEntry.getName(), searchBase); memberDNs.add(dynaMbrDN); } } } else { if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " LDAP URL=null."); } } } } catch (NamingException e) { throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, Tr.formatMessage( tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)))); } } return memberDNs; } }
public class class_name { private List<String> getDynamicMembers(Attribute groupMemberURLs) throws WIMException { final String METHODNAME = "getDynamicMembers"; List<String> memberDNs = new ArrayList<String>(); if (groupMemberURLs != null) { try { for (NamingEnumeration<?> enu = groupMemberURLs.getAll(); enu.hasMoreElements();) { String ldapurlStr = (String) (enu.nextElement()); if (ldapurlStr != null) { LdapURL ldapURL = new LdapURL(ldapurlStr); if (ldapURL.parsedOK()) { int searchScope = SearchControls.OBJECT_SCOPE; String scopeBuf = ldapURL.get_scope(); if (scopeBuf != null) { if (scopeBuf.compareToIgnoreCase("base") == 0) { searchScope = SearchControls.OBJECT_SCOPE; // depends on control dependency: [if], data = [none] } else if (scopeBuf.compareToIgnoreCase("one") == 0) { searchScope = SearchControls.ONELEVEL_SCOPE; // depends on control dependency: [if], data = [none] } else if (scopeBuf.compareToIgnoreCase("sub") == 0) { searchScope = SearchControls.SUBTREE_SCOPE; // depends on control dependency: [if], data = [none] } } String searchFilter = ldapURL.get_filter(); if (searchFilter == null) { searchFilter = "(objectClass=*)"; } String searchBase = ldapURL.get_dn(); // depends on control dependency: [if], data = [none] String[] attributesToReturn = ldapURL.get_attributes(); for (NamingEnumeration<?> nenu = iLdapConn.search(searchBase, searchFilter, searchScope, attributesToReturn); nenu.hasMoreElements();) { javax.naming.directory.SearchResult thisEntry = (javax.naming.directory.SearchResult) nenu.nextElement(); if (thisEntry == null) { continue; } String dynaMbrDN = LdapHelper.prepareDN(thisEntry.getName(), searchBase); memberDNs.add(dynaMbrDN); // depends on control dependency: [for], data = [none] } } } else { if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " LDAP URL=null."); // depends on control dependency: [if], data = [none] } } } } catch (NamingException e) { throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, Tr.formatMessage( tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)))); } } return memberDNs; } }
public class class_name { @Local public CompletableFuture<Integer> broadcastAction(final WebSocketAction action) { if (this.localEngine != null && this.sncpNodeAddresses == null) { //本地模式且没有分布式 return this.localEngine.broadcastLocalAction(action); } CompletableFuture<Integer> localFuture = this.localEngine == null ? null : this.localEngine.broadcastLocalAction(action); tryAcquireSemaphore(); CompletableFuture<Collection<InetSocketAddress>> addrsFuture = sncpNodeAddresses.getCollectionAsync(SOURCE_SNCP_ADDRS_KEY, InetSocketAddress.class); if (semaphore != null) addrsFuture.whenComplete((r, e) -> releaseSemaphore()); CompletableFuture<Integer> remoteFuture = addrsFuture.thenCompose((Collection<InetSocketAddress> addrs) -> { if (logger.isLoggable(Level.FINEST)) logger.finest("websocket broadcast action (" + action + ") on " + addrs); if (addrs == null || addrs.isEmpty()) return CompletableFuture.completedFuture(0); CompletableFuture<Integer> future = null; for (InetSocketAddress addr : addrs) { if (addr == null || addr.equals(localSncpAddress)) continue; future = future == null ? remoteNode.broadcastAction(addr, action) : future.thenCombine(remoteNode.broadcastAction(addr, action), (a, b) -> a | b); } return future == null ? CompletableFuture.completedFuture(0) : future; }); return localFuture == null ? remoteFuture : localFuture.thenCombine(remoteFuture, (a, b) -> a | b); } }
public class class_name { @Local public CompletableFuture<Integer> broadcastAction(final WebSocketAction action) { if (this.localEngine != null && this.sncpNodeAddresses == null) { //本地模式且没有分布式 return this.localEngine.broadcastLocalAction(action); // depends on control dependency: [if], data = [none] } CompletableFuture<Integer> localFuture = this.localEngine == null ? null : this.localEngine.broadcastLocalAction(action); tryAcquireSemaphore(); CompletableFuture<Collection<InetSocketAddress>> addrsFuture = sncpNodeAddresses.getCollectionAsync(SOURCE_SNCP_ADDRS_KEY, InetSocketAddress.class); if (semaphore != null) addrsFuture.whenComplete((r, e) -> releaseSemaphore()); CompletableFuture<Integer> remoteFuture = addrsFuture.thenCompose((Collection<InetSocketAddress> addrs) -> { if (logger.isLoggable(Level.FINEST)) logger.finest("websocket broadcast action (" + action + ") on " + addrs); if (addrs == null || addrs.isEmpty()) return CompletableFuture.completedFuture(0); CompletableFuture<Integer> future = null; for (InetSocketAddress addr : addrs) { if (addr == null || addr.equals(localSncpAddress)) continue; future = future == null ? remoteNode.broadcastAction(addr, action) : future.thenCombine(remoteNode.broadcastAction(addr, action), (a, b) -> a | b); } return future == null ? CompletableFuture.completedFuture(0) : future; }); return localFuture == null ? remoteFuture : localFuture.thenCombine(remoteFuture, (a, b) -> a | b); } }
public class class_name { public static void updateTmpDirectoriesInConfiguration( Configuration configuration, @Nullable String defaultDirs) { if (configuration.contains(CoreOptions.TMP_DIRS)) { LOG.info("Overriding Fink's temporary file directories with those " + "specified in the Flink config: {}", configuration.getValue(CoreOptions.TMP_DIRS)); } else if (defaultDirs != null) { LOG.info("Setting directories for temporary files to: {}", defaultDirs); configuration.setString(CoreOptions.TMP_DIRS, defaultDirs); configuration.setBoolean(USE_LOCAL_DEFAULT_TMP_DIRS, true); } } }
public class class_name { public static void updateTmpDirectoriesInConfiguration( Configuration configuration, @Nullable String defaultDirs) { if (configuration.contains(CoreOptions.TMP_DIRS)) { LOG.info("Overriding Fink's temporary file directories with those " + "specified in the Flink config: {}", configuration.getValue(CoreOptions.TMP_DIRS)); // depends on control dependency: [if], data = [none] } else if (defaultDirs != null) { LOG.info("Setting directories for temporary files to: {}", defaultDirs); // depends on control dependency: [if], data = [none] configuration.setString(CoreOptions.TMP_DIRS, defaultDirs); // depends on control dependency: [if], data = [none] configuration.setBoolean(USE_LOCAL_DEFAULT_TMP_DIRS, true); // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") static <T, A extends BindingCollectionAdapter<T>> A createClass(Class<? extends BindingCollectionAdapter> adapterClass, ItemBinding<T> itemBinding) { try { return (A) adapterClass.getConstructor(ItemBinding.class).newInstance(itemBinding); } catch (Exception e1) { throw new RuntimeException(e1); } } }
public class class_name { @SuppressWarnings("unchecked") static <T, A extends BindingCollectionAdapter<T>> A createClass(Class<? extends BindingCollectionAdapter> adapterClass, ItemBinding<T> itemBinding) { try { return (A) adapterClass.getConstructor(ItemBinding.class).newInstance(itemBinding); // depends on control dependency: [try], data = [none] } catch (Exception e1) { throw new RuntimeException(e1); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Entity setFieldNames(Collection<String> fieldNames) { if (CollectionUtil.isNotEmpty(fieldNames)) { this.fieldNames = new HashSet<String>(fieldNames); } return this; } }
public class class_name { public Entity setFieldNames(Collection<String> fieldNames) { if (CollectionUtil.isNotEmpty(fieldNames)) { this.fieldNames = new HashSet<String>(fieldNames); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { @SuppressWarnings("unchecked") public static <D, J> D toData(Class<? extends PreferenceTypeAdapter<J, D>> clazz, J javaValue) { PreferenceTypeAdapter<J, D> adapter = cache.get(clazz); if (adapter == null) { try { lock.lock(); adapter = clazz.newInstance(); cache.put(clazz, adapter); } catch (Throwable e) { throw (new KriptonRuntimeException(e)); } finally { lock.unlock(); } } return adapter.toData(javaValue); } }
public class class_name { @SuppressWarnings("unchecked") public static <D, J> D toData(Class<? extends PreferenceTypeAdapter<J, D>> clazz, J javaValue) { PreferenceTypeAdapter<J, D> adapter = cache.get(clazz); if (adapter == null) { try { lock.lock(); // depends on control dependency: [try], data = [none] adapter = clazz.newInstance(); // depends on control dependency: [try], data = [none] cache.put(clazz, adapter); // depends on control dependency: [try], data = [none] } catch (Throwable e) { throw (new KriptonRuntimeException(e)); } finally { // depends on control dependency: [catch], data = [none] lock.unlock(); } } return adapter.toData(javaValue); } }
public class class_name { @Override public void actionPerformed(ActionEvent arg0) { try { final OWLWorkspace workspace = editorKit.getWorkspace(); if (obdaModel.getSources().isEmpty()) { JOptionPane.showMessageDialog(workspace, "The data source is missing. Create one in ontop Mappings. "); } else { // Get the path of the file of the active OWL model OWLOntology activeOntology = modelManager.getActiveOntology(); IRI documentIRI = modelManager.getOWLOntologyManager().getOntologyDocumentIRI(activeOntology); File ontologyDir = new File(documentIRI.toURI().getPath()); final JFileChooser fc = new JFileChooser(ontologyDir); final String shortForm = documentIRI.getShortForm(); int i = shortForm.lastIndexOf("."); String ontologyName = (i < 1)? shortForm: shortForm.substring(0, i); fc.setSelectedFile(new File(ontologyName + "-mapping.ttl")); //fc.setSelectedFile(new File(sourceID + "-mapping.ttl")); int approve = fc.showSaveDialog(workspace); if(approve == JFileChooser.APPROVE_OPTION) { final File file = fc.getSelectedFile(); Thread th = new Thread("R2RML Export Action Thread"){ @Override public void run() { try { OBDAProgressMonitor monitor = new OBDAProgressMonitor( "Exporting the mapping to R2RML...", workspace); R2RMLExportThread t = new R2RMLExportThread(); monitor.addProgressListener(t); monitor.start(); t.run(file); monitor.stop(); JOptionPane.showMessageDialog(workspace, "R2RML Export completed.", "Done", JOptionPane.INFORMATION_MESSAGE); } catch (Exception e) { JOptionPane.showMessageDialog(workspace, "An error occurred. For more info, see the logs."); log.error("Error during R2RML export. \n", e.getMessage()); e.printStackTrace(); } } }; th.start(); } } } catch (Exception ex) { JOptionPane.showMessageDialog(getWorkspace(), "An error occurred. For more info, see the logs."); log.error("Error during R2RML export. \n"); ex.printStackTrace(); } } }
public class class_name { @Override public void actionPerformed(ActionEvent arg0) { try { final OWLWorkspace workspace = editorKit.getWorkspace(); if (obdaModel.getSources().isEmpty()) { JOptionPane.showMessageDialog(workspace, "The data source is missing. Create one in ontop Mappings. "); // depends on control dependency: [if], data = [none] } else { // Get the path of the file of the active OWL model OWLOntology activeOntology = modelManager.getActiveOntology(); IRI documentIRI = modelManager.getOWLOntologyManager().getOntologyDocumentIRI(activeOntology); File ontologyDir = new File(documentIRI.toURI().getPath()); final JFileChooser fc = new JFileChooser(ontologyDir); final String shortForm = documentIRI.getShortForm(); int i = shortForm.lastIndexOf("."); String ontologyName = (i < 1)? shortForm: shortForm.substring(0, i); fc.setSelectedFile(new File(ontologyName + "-mapping.ttl")); // depends on control dependency: [if], data = [none] //fc.setSelectedFile(new File(sourceID + "-mapping.ttl")); int approve = fc.showSaveDialog(workspace); if(approve == JFileChooser.APPROVE_OPTION) { final File file = fc.getSelectedFile(); Thread th = new Thread("R2RML Export Action Thread"){ @Override public void run() { try { OBDAProgressMonitor monitor = new OBDAProgressMonitor( "Exporting the mapping to R2RML...", workspace); R2RMLExportThread t = new R2RMLExportThread(); monitor.addProgressListener(t); // depends on control dependency: [try], data = [none] monitor.start(); // depends on control dependency: [try], data = [none] t.run(file); // depends on control dependency: [try], data = [none] monitor.stop(); // depends on control dependency: [try], data = [none] JOptionPane.showMessageDialog(workspace, "R2RML Export completed.", "Done", JOptionPane.INFORMATION_MESSAGE); // depends on control dependency: [try], data = [none] } catch (Exception e) { JOptionPane.showMessageDialog(workspace, "An error occurred. For more info, see the logs."); log.error("Error during R2RML export. \n", e.getMessage()); e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }; th.start(); // depends on control dependency: [if], data = [none] } } } catch (Exception ex) { JOptionPane.showMessageDialog(getWorkspace(), "An error occurred. For more info, see the logs."); log.error("Error during R2RML export. \n"); ex.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public EList<JvmGenericType> getLocalClasses() { if (localClasses == null) { localClasses = new EObjectContainmentEList<JvmGenericType>(JvmGenericType.class, this, TypesPackage.JVM_FEATURE__LOCAL_CLASSES); } return localClasses; } }
public class class_name { public EList<JvmGenericType> getLocalClasses() { if (localClasses == null) { localClasses = new EObjectContainmentEList<JvmGenericType>(JvmGenericType.class, this, TypesPackage.JVM_FEATURE__LOCAL_CLASSES); // depends on control dependency: [if], data = [none] } return localClasses; } }
public class class_name { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.CUSTOM) public static Observable<Long> intervalRange(long start, long count, long initialDelay, long period, TimeUnit unit, Scheduler scheduler) { if (count < 0) { throw new IllegalArgumentException("count >= 0 required but it was " + count); } if (count == 0L) { return Observable.<Long>empty().delay(initialDelay, unit, scheduler); } long end = start + (count - 1); if (start > 0 && end < 0) { throw new IllegalArgumentException("Overflow! start + count is bigger than Long.MAX_VALUE"); } ObjectHelper.requireNonNull(unit, "unit is null"); ObjectHelper.requireNonNull(scheduler, "scheduler is null"); return RxJavaPlugins.onAssembly(new ObservableIntervalRange(start, end, Math.max(0L, initialDelay), Math.max(0L, period), unit, scheduler)); } }
public class class_name { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.CUSTOM) public static Observable<Long> intervalRange(long start, long count, long initialDelay, long period, TimeUnit unit, Scheduler scheduler) { if (count < 0) { throw new IllegalArgumentException("count >= 0 required but it was " + count); } if (count == 0L) { return Observable.<Long>empty().delay(initialDelay, unit, scheduler); // depends on control dependency: [if], data = [none] } long end = start + (count - 1); if (start > 0 && end < 0) { throw new IllegalArgumentException("Overflow! start + count is bigger than Long.MAX_VALUE"); } ObjectHelper.requireNonNull(unit, "unit is null"); ObjectHelper.requireNonNull(scheduler, "scheduler is null"); return RxJavaPlugins.onAssembly(new ObservableIntervalRange(start, end, Math.max(0L, initialDelay), Math.max(0L, period), unit, scheduler)); } }
public class class_name { public static <P extends Enum<P>> JSONObject putDefault(JSONObject json, P e, PointF defPoint, boolean allowImplicitPoint) { if (json != null) { JSONObject pointJson = optJSONObject(json, e); if (pointJson != null) { // Check both members; default if missing try { if (!hasNumber(pointJson, "x", true)) { pointJson.put("x", defPoint.x); } if (!hasNumber(pointJson, "y", true)) { pointJson.put("y", defPoint.y); } } catch (JSONException e1) { throw new RuntimeException(e1); } } else { // Some properties allow a point to be implicitly specified with a single number, // which is then used for both 'x' and 'y' values. if (!(allowImplicitPoint && hasNumber(json, e))) { put(json, e, defPoint); } } } return json; } }
public class class_name { public static <P extends Enum<P>> JSONObject putDefault(JSONObject json, P e, PointF defPoint, boolean allowImplicitPoint) { if (json != null) { JSONObject pointJson = optJSONObject(json, e); if (pointJson != null) { // Check both members; default if missing try { if (!hasNumber(pointJson, "x", true)) { pointJson.put("x", defPoint.x); // depends on control dependency: [if], data = [none] } if (!hasNumber(pointJson, "y", true)) { pointJson.put("y", defPoint.y); // depends on control dependency: [if], data = [none] } } catch (JSONException e1) { throw new RuntimeException(e1); } // depends on control dependency: [catch], data = [none] } else { // Some properties allow a point to be implicitly specified with a single number, // which is then used for both 'x' and 'y' values. if (!(allowImplicitPoint && hasNumber(json, e))) { put(json, e, defPoint); // depends on control dependency: [if], data = [none] } } } return json; } }
public class class_name { public static boolean instanceOf(Object data, Class type) { //这里有一个事实,即参数data必定是非原生类型,即使传入时是原生类型,它也被java强制转化为Object非原生了. //here we rely on the jdk default behavior of packing primitive type parameter into packed type, //which means that if you passe an int to the data parameter, right here within this method, //you will always get an Integer object. if (type.isInstance(data)) { return true; } if (data == null) { return false; } if (type.isPrimitive()) { if (type == int.class) { type = Integer.class; } else if (type == long.class) { type = Long.class; } else if (type == short.class) { type = Short.class; } else if (type == double.class) { type = Double.class; } else if (type == float.class) { type = Float.class; } else if (type == char.class) { type = Character.class; } else if (type == byte.class) { type = Byte.class; } else if (type == boolean.class) { type = Boolean.class; } } return type.isInstance(data); } }
public class class_name { public static boolean instanceOf(Object data, Class type) { //这里有一个事实,即参数data必定是非原生类型,即使传入时是原生类型,它也被java强制转化为Object非原生了. //here we rely on the jdk default behavior of packing primitive type parameter into packed type, //which means that if you passe an int to the data parameter, right here within this method, //you will always get an Integer object. if (type.isInstance(data)) { return true; // depends on control dependency: [if], data = [none] } if (data == null) { return false; // depends on control dependency: [if], data = [none] } if (type.isPrimitive()) { if (type == int.class) { type = Integer.class; // depends on control dependency: [if], data = [none] } else if (type == long.class) { type = Long.class; // depends on control dependency: [if], data = [none] } else if (type == short.class) { type = Short.class; // depends on control dependency: [if], data = [none] } else if (type == double.class) { type = Double.class; // depends on control dependency: [if], data = [none] } else if (type == float.class) { type = Float.class; // depends on control dependency: [if], data = [none] } else if (type == char.class) { type = Character.class; // depends on control dependency: [if], data = [none] } else if (type == byte.class) { type = Byte.class; // depends on control dependency: [if], data = [none] } else if (type == boolean.class) { type = Boolean.class; // depends on control dependency: [if], data = [none] } } return type.isInstance(data); } }
public class class_name { public void setAckReceived(long cSeq, boolean ackReceived) { if(logger.isDebugEnabled()) { logger.debug("setting AckReceived to : " + ackReceived + " for CSeq " + cSeq); } acksReceived.put(cSeq, ackReceived); if(ackReceived) { cleanupAcksReceived(cSeq); } } }
public class class_name { public void setAckReceived(long cSeq, boolean ackReceived) { if(logger.isDebugEnabled()) { logger.debug("setting AckReceived to : " + ackReceived + " for CSeq " + cSeq); // depends on control dependency: [if], data = [none] } acksReceived.put(cSeq, ackReceived); if(ackReceived) { cleanupAcksReceived(cSeq); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void beginTransaction() { if (currentTransaction == null) { try { currentTransaction = StructrApp.getInstance(securityContext).tx(true, false, false); } catch (FrameworkException fex) { // transaction can fail here (theoretically...) logger.warn("Unable to begin transaction.", fex); } } } }
public class class_name { private void beginTransaction() { if (currentTransaction == null) { try { currentTransaction = StructrApp.getInstance(securityContext).tx(true, false, false); // depends on control dependency: [try], data = [none] } catch (FrameworkException fex) { // transaction can fail here (theoretically...) logger.warn("Unable to begin transaction.", fex); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void sendBatch() { LrsStatement statement = null; List<LrsStatement> list = new ArrayList<LrsStatement>(); while ((statement = statementQueue.poll()) != null) { list.add(statement); } if (!list.isEmpty()) { postStatementList(list); } } }
public class class_name { public void sendBatch() { LrsStatement statement = null; List<LrsStatement> list = new ArrayList<LrsStatement>(); while ((statement = statementQueue.poll()) != null) { list.add(statement); // depends on control dependency: [while], data = [none] } if (!list.isEmpty()) { postStatementList(list); // depends on control dependency: [if], data = [none] } } }
public class class_name { public QueryNode[] getOperands() { if (operands == null) { return new QueryNode[0]; } else { return (QueryNode[]) operands.toArray(new QueryNode[operands.size()]); } } }
public class class_name { public QueryNode[] getOperands() { if (operands == null) { return new QueryNode[0]; // depends on control dependency: [if], data = [none] } else { return (QueryNode[]) operands.toArray(new QueryNode[operands.size()]); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void encodeThis() throws IOException { DerOutputStream out = new DerOutputStream(); DerOutputStream tmp = new DerOutputStream(); if (ca) { tmp.putBoolean(ca); // Only encode pathLen when ca == true if (pathLen >= 0) { tmp.putInteger(pathLen); } } out.write(DerValue.tag_Sequence, tmp); this.extensionValue = out.toByteArray(); } }
public class class_name { private void encodeThis() throws IOException { DerOutputStream out = new DerOutputStream(); DerOutputStream tmp = new DerOutputStream(); if (ca) { tmp.putBoolean(ca); // Only encode pathLen when ca == true if (pathLen >= 0) { tmp.putInteger(pathLen); // depends on control dependency: [if], data = [(pathLen] } } out.write(DerValue.tag_Sequence, tmp); this.extensionValue = out.toByteArray(); } }
public class class_name { public void setEditButtonsVisible(boolean visible) { if (visible) { m_editButtonVibility.setValue( org.opencms.ade.containerpage.client.ui.css.I_CmsLayoutBundle.INSTANCE.containerpageCss().editButtonsVisible()); } else { m_editButtonVibility.setValue(null); } } }
public class class_name { public void setEditButtonsVisible(boolean visible) { if (visible) { m_editButtonVibility.setValue( org.opencms.ade.containerpage.client.ui.css.I_CmsLayoutBundle.INSTANCE.containerpageCss().editButtonsVisible()); // depends on control dependency: [if], data = [none] } else { m_editButtonVibility.setValue(null); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String stripNonValidXMLCharacters(String input) { if (input == null || ("".equals(input))) return ""; StringBuilder out = new StringBuilder(); char current; for (int i = 0; i < input.length(); i++) { current = input.charAt(i); if ((current == 0x9) || (current == 0xA) || (current == 0xD) || ((current >= 0x20) && (current <= 0xD7FF)) || ((current >= 0xE000) && (current <= 0xFFFD)) || ((current >= 0x10000) && (current <= 0x10FFFF))) out.append(current); } return out.toString(); } }
public class class_name { public static String stripNonValidXMLCharacters(String input) { if (input == null || ("".equals(input))) return ""; StringBuilder out = new StringBuilder(); char current; for (int i = 0; i < input.length(); i++) { current = input.charAt(i); // depends on control dependency: [for], data = [i] if ((current == 0x9) || (current == 0xA) || (current == 0xD) || ((current >= 0x20) && (current <= 0xD7FF)) || ((current >= 0xE000) && (current <= 0xFFFD)) || ((current >= 0x10000) && (current <= 0x10FFFF))) out.append(current); } return out.toString(); } }
public class class_name { public MethodState getSaved(int idx) { if (idx < 0) { throw new IllegalArgumentException(); } MethodState state = firstPointer; for (int i = 0; i < idx; i++) { state = state.getNext(); if (state == null) { throw new IllegalArgumentException(); } } return state; } }
public class class_name { public MethodState getSaved(int idx) { if (idx < 0) { throw new IllegalArgumentException(); } MethodState state = firstPointer; for (int i = 0; i < idx; i++) { state = state.getNext(); // depends on control dependency: [for], data = [none] if (state == null) { throw new IllegalArgumentException(); } } return state; } }
public class class_name { public static Field getProtectedField(Class klass, String fieldName) { Field field; try { field = klass.getDeclaredField(fieldName); field.setAccessible(true); } catch (Exception e) { throw new AssertionError(e); } return field; } }
public class class_name { public static Field getProtectedField(Class klass, String fieldName) { Field field; try { field = klass.getDeclaredField(fieldName); // depends on control dependency: [try], data = [none] field.setAccessible(true); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new AssertionError(e); } // depends on control dependency: [catch], data = [none] return field; } }
public class class_name { public static void printClassDetails(final Object pObject, final String pObjectName, final PrintStream pPrintStream) { if (pPrintStream == null) { System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE); return; } pPrintStream.println(getClassDetails(pObject, pObjectName)); } }
public class class_name { public static void printClassDetails(final Object pObject, final String pObjectName, final PrintStream pPrintStream) { if (pPrintStream == null) { System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } pPrintStream.println(getClassDetails(pObject, pObjectName)); } }
public class class_name { private void moveDataAfterIndex(int index, int length) { ensureCapacity(Math.max(this.position, index) + length); if (index < this.position) { // 插入位置在已有数据范围内,后移插入位置之后的数据 System.arraycopy(this.value, index, this.value, index + length, this.position - index); } else if (index > this.position) { // 插入位置超出范围,则当前位置到index清除为空格 Arrays.fill(this.value, this.position, index, StrUtil.C_SPACE); } // 不位移 } }
public class class_name { private void moveDataAfterIndex(int index, int length) { ensureCapacity(Math.max(this.position, index) + length); if (index < this.position) { // 插入位置在已有数据范围内,后移插入位置之后的数据 System.arraycopy(this.value, index, this.value, index + length, this.position - index); // depends on control dependency: [if], data = [none] } else if (index > this.position) { // 插入位置超出范围,则当前位置到index清除为空格 Arrays.fill(this.value, this.position, index, StrUtil.C_SPACE); // depends on control dependency: [if], data = [none] } // 不位移 } }
public class class_name { private Drawable getDrawable(Uri uri) { try { String scheme = uri.getScheme(); if (ContentResolver.SCHEME_ANDROID_RESOURCE.equals(scheme)) { // Load drawables through Resources, to get the source density information try { return getDrawableFromResourceUri(uri); } catch (Resources.NotFoundException ex) { throw new FileNotFoundException("Resource does not exist: " + uri); } } else { // Let the ContentResolver handle content and file URIs. InputStream stream = mProviderContext.getContentResolver().openInputStream(uri); if (stream == null) { throw new FileNotFoundException("Failed to open " + uri); } try { return Drawable.createFromStream(stream, null); } finally { try { stream.close(); } catch (IOException ex) { Log.e(LOG_TAG, "Error closing icon stream for " + uri, ex); } } } } catch (FileNotFoundException fnfe) { Log.w(LOG_TAG, "Icon not found: " + uri + ", " + fnfe.getMessage()); return null; } } }
public class class_name { private Drawable getDrawable(Uri uri) { try { String scheme = uri.getScheme(); if (ContentResolver.SCHEME_ANDROID_RESOURCE.equals(scheme)) { // Load drawables through Resources, to get the source density information try { return getDrawableFromResourceUri(uri); // depends on control dependency: [try], data = [none] } catch (Resources.NotFoundException ex) { throw new FileNotFoundException("Resource does not exist: " + uri); } // depends on control dependency: [catch], data = [none] } else { // Let the ContentResolver handle content and file URIs. InputStream stream = mProviderContext.getContentResolver().openInputStream(uri); if (stream == null) { throw new FileNotFoundException("Failed to open " + uri); } try { return Drawable.createFromStream(stream, null); // depends on control dependency: [try], data = [none] } finally { try { stream.close(); // depends on control dependency: [try], data = [none] } catch (IOException ex) { Log.e(LOG_TAG, "Error closing icon stream for " + uri, ex); } // depends on control dependency: [catch], data = [none] } } } catch (FileNotFoundException fnfe) { Log.w(LOG_TAG, "Icon not found: " + uri + ", " + fnfe.getMessage()); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static FloatIteratorEx of(final Supplier<? extends FloatIterator> iteratorSupplier) { N.checkArgNotNull(iteratorSupplier, "iteratorSupplier"); return new FloatIteratorEx() { private FloatIterator iter = null; private FloatIteratorEx iterEx = null; private boolean isInitialized = false; @Override public boolean hasNext() { if (isInitialized == false) { init(); } return iter.hasNext(); } @Override public float nextFloat() { if (isInitialized == false) { init(); } return iter.nextFloat(); } @Override public void skip(long n) { N.checkArgNotNegative(n, "n"); if (isInitialized == false) { init(); } if (iterEx != null) { iterEx.skip(n); } else { super.skip(n); } } @Override public long count() { if (isInitialized == false) { init(); } if (iterEx != null) { return iterEx.count(); } else { return super.count(); } } @Override public void close() { if (isInitialized == false) { init(); } if (iterEx != null) { iterEx.close(); } } private void init() { if (isInitialized == false) { isInitialized = true; iter = iteratorSupplier.get(); iterEx = iter instanceof FloatIteratorEx ? (FloatIteratorEx) iter : null; } } }; } }
public class class_name { public static FloatIteratorEx of(final Supplier<? extends FloatIterator> iteratorSupplier) { N.checkArgNotNull(iteratorSupplier, "iteratorSupplier"); return new FloatIteratorEx() { private FloatIterator iter = null; private FloatIteratorEx iterEx = null; private boolean isInitialized = false; @Override public boolean hasNext() { if (isInitialized == false) { init(); // depends on control dependency: [if], data = [none] } return iter.hasNext(); } @Override public float nextFloat() { if (isInitialized == false) { init(); // depends on control dependency: [if], data = [none] } return iter.nextFloat(); } @Override public void skip(long n) { N.checkArgNotNegative(n, "n"); if (isInitialized == false) { init(); // depends on control dependency: [if], data = [none] } if (iterEx != null) { iterEx.skip(n); // depends on control dependency: [if], data = [none] } else { super.skip(n); // depends on control dependency: [if], data = [none] } } @Override public long count() { if (isInitialized == false) { init(); // depends on control dependency: [if], data = [none] } if (iterEx != null) { return iterEx.count(); // depends on control dependency: [if], data = [none] } else { return super.count(); // depends on control dependency: [if], data = [none] } } @Override public void close() { if (isInitialized == false) { init(); // depends on control dependency: [if], data = [none] } if (iterEx != null) { iterEx.close(); // depends on control dependency: [if], data = [none] } } private void init() { if (isInitialized == false) { isInitialized = true; // depends on control dependency: [if], data = [none] iter = iteratorSupplier.get(); // depends on control dependency: [if], data = [none] iterEx = iter instanceof FloatIteratorEx ? (FloatIteratorEx) iter : null; // depends on control dependency: [if], data = [none] } } }; } }
public class class_name { private Region find(long size) { validate(!VALIDATING || Long.bitCount(size) == 1); Node<Region> currentNode = getRoot(); Region currentRegion = currentNode.getPayload(); if (currentRegion == null || (currentRegion.available() & size) == 0) { //no region big enough for us... return null; } else { while (true) { Region left = currentNode.getLeft().getPayload(); if (left != null && (left.available() & size) != 0) { currentNode = currentNode.getLeft(); currentRegion = currentNode.getPayload(); } else if ((currentRegion.availableHere() & size) != 0) { long mask = size - 1; long a = (currentRegion.start() + mask) & ~mask; return new Region(a, a + size - 1); } else { Region right = currentNode.getRight().getPayload(); if (right != null && (right.available() & size) != 0) { currentNode = currentNode.getRight(); currentRegion = currentNode.getPayload(); } else { throw new AssertionError(); } } } } } }
public class class_name { private Region find(long size) { validate(!VALIDATING || Long.bitCount(size) == 1); Node<Region> currentNode = getRoot(); Region currentRegion = currentNode.getPayload(); if (currentRegion == null || (currentRegion.available() & size) == 0) { //no region big enough for us... return null; // depends on control dependency: [if], data = [none] } else { while (true) { Region left = currentNode.getLeft().getPayload(); if (left != null && (left.available() & size) != 0) { currentNode = currentNode.getLeft(); // depends on control dependency: [if], data = [none] currentRegion = currentNode.getPayload(); // depends on control dependency: [if], data = [none] } else if ((currentRegion.availableHere() & size) != 0) { long mask = size - 1; long a = (currentRegion.start() + mask) & ~mask; return new Region(a, a + size - 1); // depends on control dependency: [if], data = [none] } else { Region right = currentNode.getRight().getPayload(); if (right != null && (right.available() & size) != 0) { currentNode = currentNode.getRight(); // depends on control dependency: [if], data = [none] currentRegion = currentNode.getPayload(); // depends on control dependency: [if], data = [none] } else { throw new AssertionError(); } } } } } }
public class class_name { private static ThreadFactory createThreadFactory(ThreadFactory threadFactory, String threadNamePrefix, Boolean daemon) { if (threadFactory != null) { return threadFactory; } if (threadNamePrefix != null) { if (daemon != null) { return ThreadPoolUtil.buildThreadFactory(threadNamePrefix, daemon); } else { return ThreadPoolUtil.buildThreadFactory(threadNamePrefix); } } return Executors.defaultThreadFactory(); } }
public class class_name { private static ThreadFactory createThreadFactory(ThreadFactory threadFactory, String threadNamePrefix, Boolean daemon) { if (threadFactory != null) { return threadFactory; // depends on control dependency: [if], data = [none] } if (threadNamePrefix != null) { if (daemon != null) { return ThreadPoolUtil.buildThreadFactory(threadNamePrefix, daemon); // depends on control dependency: [if], data = [none] } else { return ThreadPoolUtil.buildThreadFactory(threadNamePrefix); // depends on control dependency: [if], data = [none] } } return Executors.defaultThreadFactory(); } }
public class class_name { private ControlAck createControlAckMessage() throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createControlAckMessage"); ControlAck ackMsg = null; // Create new AckMessage try { ackMsg = _cmf.createNewControlAck(); } catch (MessageCreateFailedException e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.PtoPInputHandler.createControlAckMessage", "1:1546:1.323", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exception(tc, e); SibTr.exit(tc, "createControlAckMessage", e); } SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.PtoPInputHandler", "1:1558:1.323", e }); throw new SIResourceException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.PtoPInputHandler", "1:1566:1.323", e }, null), e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createControlAckMessage"); return ackMsg; } }
public class class_name { private ControlAck createControlAckMessage() throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createControlAckMessage"); ControlAck ackMsg = null; // Create new AckMessage try { ackMsg = _cmf.createNewControlAck(); } catch (MessageCreateFailedException e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.PtoPInputHandler.createControlAckMessage", "1:1546:1.323", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exception(tc, e); // depends on control dependency: [if], data = [none] SibTr.exit(tc, "createControlAckMessage", e); // depends on control dependency: [if], data = [none] } SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.PtoPInputHandler", "1:1558:1.323", e }); throw new SIResourceException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.PtoPInputHandler", "1:1566:1.323", e }, null), e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createControlAckMessage"); return ackMsg; } }
public class class_name { public String getKeyValue(String key){ String keyName = keysMap.get(key); if (keyName != null){ return keyName; } return ""; //key wasn't defined in keys properties file } }
public class class_name { public String getKeyValue(String key){ String keyName = keysMap.get(key); if (keyName != null){ return keyName; // depends on control dependency: [if], data = [none] } return ""; //key wasn't defined in keys properties file } }
public class class_name { @Override public void sortAtomContainers(final Comparator<IAtomContainer> comparator) { // need to use boxed primitives as we can't customise sorting of int primitives Integer[] indexes = new Integer[atomContainerCount]; for (int i = 0; i < indexes.length; i++) indexes[i] = i; // proxy the index comparison to the atom container comparator Arrays.sort(indexes, new Comparator<Integer>() { @Override public int compare(Integer o1, Integer o2) { return comparator.compare(atomContainers[o1], atomContainers[o2]); } }); // copy the original arrays (we could modify in place with swaps but this is cleaner) IAtomContainer[] containersTmp = Arrays.copyOf(atomContainers, indexes.length); Double[] multipliersTmp = Arrays.copyOf(multipliers, indexes.length); // order the arrays based on the order of the indices for (int i = 0; i < indexes.length; i++) { atomContainers[i] = containersTmp[indexes[i]]; multipliers[i] = multipliersTmp[indexes[i]]; } } }
public class class_name { @Override public void sortAtomContainers(final Comparator<IAtomContainer> comparator) { // need to use boxed primitives as we can't customise sorting of int primitives Integer[] indexes = new Integer[atomContainerCount]; for (int i = 0; i < indexes.length; i++) indexes[i] = i; // proxy the index comparison to the atom container comparator Arrays.sort(indexes, new Comparator<Integer>() { @Override public int compare(Integer o1, Integer o2) { return comparator.compare(atomContainers[o1], atomContainers[o2]); } }); // copy the original arrays (we could modify in place with swaps but this is cleaner) IAtomContainer[] containersTmp = Arrays.copyOf(atomContainers, indexes.length); Double[] multipliersTmp = Arrays.copyOf(multipliers, indexes.length); // order the arrays based on the order of the indices for (int i = 0; i < indexes.length; i++) { atomContainers[i] = containersTmp[indexes[i]]; // depends on control dependency: [for], data = [i] multipliers[i] = multipliersTmp[indexes[i]]; // depends on control dependency: [for], data = [i] } } }
public class class_name { @Override @FFDCIgnore(IOException.class) public void error(VirtualConnection vc, TCPReadRequestContext rsc, IOException ioe) { boolean closing = false; boolean isFirstRead = false; synchronized(_srtUpgradeStream){ closing = _upgradeStream.isClosing(); isFirstRead = _upgradeStream.isFirstRead(); _upgradeStream.setIsInitialRead(false); } if(!closing){ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Encountered an error during the initial read for data : " + ioe + ", " + _rl); } try{ //Set the original Context Class Loader before calling the users onDataAvailable //Push the original thread's context onto the current thread, also save off the current thread's context _contextManager.pushContextData(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Error encountered while we are not closing : " + _rl); } if(!isFirstRead){ if(WCCustomProperties31.UPGRADE_READ_TIMEOUT != TCPReadRequestContext.NO_TIMEOUT && ioe instanceof SocketTimeoutException){ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Other side did not send data within the timeout time, calling onError : " + _rl); } if(! _upgradeStream.isIsonErrorCalled()) { _upgradeStream.setIsonErrorCalled(true); _rl.onError(ioe); } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Other side must be closed, check if not called before call onAllDataRead : " + _rl); } if(! _upgradeStream.isAlldataReadCalled()) { try{ //We will call onAllDataRead if we encounter the error because we assume the other side has closed the connection since there is no timeout currently //The other side closing the connection means that we have read all the data _upgradeStream.setAlldataReadCalled(true); _rl.onAllDataRead(); } catch(Throwable onAllDataReadException){ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Encountered an error during ReadListener.onAllDataRead : " + onAllDataReadException + ", " + _rl); } if(! _upgradeStream.isIsonErrorCalled()) { _upgradeStream.setIsonErrorCalled(true); _rl.onError(onAllDataReadException); } } } } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Encountered an error during the first initialRead for data, calling the ReadListener.onError : " + _rl); } if (TraceComponent.isAnyTracingEnabled() && tc.isErrorEnabled()) Tr.error(tc, "setReadListener.initialread.failed"); if(! _upgradeStream.isIsonErrorCalled()) { _upgradeStream.setIsonErrorCalled(true); _rl.onError(ioe); } } } finally { try { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "finally call close from ReadListener.onError : " + _rl); } _upgradeStream.getWebConn().close(); } catch( Exception e ) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught exception during WebConnection.close : " + e + "," + _rl); } } //Revert back to the thread's current context _contextManager.popContextData(); } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "We are closing, skipping the call to onError"); } synchronized(_srtUpgradeStream){ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Issuing the notify"); } _srtUpgradeStream.notify(); } } } }
public class class_name { @Override @FFDCIgnore(IOException.class) public void error(VirtualConnection vc, TCPReadRequestContext rsc, IOException ioe) { boolean closing = false; boolean isFirstRead = false; synchronized(_srtUpgradeStream){ closing = _upgradeStream.isClosing(); isFirstRead = _upgradeStream.isFirstRead(); _upgradeStream.setIsInitialRead(false); } if(!closing){ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Encountered an error during the initial read for data : " + ioe + ", " + _rl); // depends on control dependency: [if], data = [none] } try{ //Set the original Context Class Loader before calling the users onDataAvailable //Push the original thread's context onto the current thread, also save off the current thread's context _contextManager.pushContextData(); // depends on control dependency: [try], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Error encountered while we are not closing : " + _rl); // depends on control dependency: [if], data = [none] } if(!isFirstRead){ if(WCCustomProperties31.UPGRADE_READ_TIMEOUT != TCPReadRequestContext.NO_TIMEOUT && ioe instanceof SocketTimeoutException){ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Other side did not send data within the timeout time, calling onError : " + _rl); // depends on control dependency: [if], data = [none] } if(! _upgradeStream.isIsonErrorCalled()) { _upgradeStream.setIsonErrorCalled(true); // depends on control dependency: [if], data = [none] _rl.onError(ioe); // depends on control dependency: [if], data = [none] } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Other side must be closed, check if not called before call onAllDataRead : " + _rl); // depends on control dependency: [if], data = [none] } if(! _upgradeStream.isAlldataReadCalled()) { try{ //We will call onAllDataRead if we encounter the error because we assume the other side has closed the connection since there is no timeout currently //The other side closing the connection means that we have read all the data _upgradeStream.setAlldataReadCalled(true); // depends on control dependency: [try], data = [none] _rl.onAllDataRead(); // depends on control dependency: [try], data = [none] } catch(Throwable onAllDataReadException){ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Encountered an error during ReadListener.onAllDataRead : " + onAllDataReadException + ", " + _rl); // depends on control dependency: [if], data = [none] } if(! _upgradeStream.isIsonErrorCalled()) { _upgradeStream.setIsonErrorCalled(true); // depends on control dependency: [if], data = [none] _rl.onError(onAllDataReadException); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Encountered an error during the first initialRead for data, calling the ReadListener.onError : " + _rl); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isErrorEnabled()) Tr.error(tc, "setReadListener.initialread.failed"); if(! _upgradeStream.isIsonErrorCalled()) { _upgradeStream.setIsonErrorCalled(true); // depends on control dependency: [if], data = [none] _rl.onError(ioe); // depends on control dependency: [if], data = [none] } } } finally { try { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "finally call close from ReadListener.onError : " + _rl); // depends on control dependency: [if], data = [none] } _upgradeStream.getWebConn().close(); // depends on control dependency: [try], data = [none] } catch( Exception e ) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught exception during WebConnection.close : " + e + "," + _rl); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] //Revert back to the thread's current context _contextManager.popContextData(); } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "We are closing, skipping the call to onError"); // depends on control dependency: [if], data = [none] } synchronized(_srtUpgradeStream){ // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Issuing the notify"); // depends on control dependency: [if], data = [none] } _srtUpgradeStream.notify(); } } } }
public class class_name { static public String getEnglishString(byte[] data) { if (null == data) { return null; } char chars[] = new char[data.length]; for (int i = 0; i < data.length; i++) { chars[i] = (char) (data[i] & 0xff); } return new String(chars); } }
public class class_name { static public String getEnglishString(byte[] data) { if (null == data) { return null; // depends on control dependency: [if], data = [none] } char chars[] = new char[data.length]; for (int i = 0; i < data.length; i++) { chars[i] = (char) (data[i] & 0xff); // depends on control dependency: [for], data = [i] } return new String(chars); } }
public class class_name { public Cell getCell(int x, int y, boolean isCreateIfNotExist) { final Row row = isCreateIfNotExist ? RowUtil.getOrCreateRow(this.sheet, y) : this.sheet.getRow(y); if (null != row) { return isCreateIfNotExist ? CellUtil.getOrCreateCell(row, x) : row.getCell(x); } return null; } }
public class class_name { public Cell getCell(int x, int y, boolean isCreateIfNotExist) { final Row row = isCreateIfNotExist ? RowUtil.getOrCreateRow(this.sheet, y) : this.sheet.getRow(y); if (null != row) { return isCreateIfNotExist ? CellUtil.getOrCreateCell(row, x) : row.getCell(x); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { protected void handleProcessTimeout(String[] cmd) throws IOException { StringBuilder bld = new StringBuilder(); boolean first = true; for (String c : cmd) { if (first) { first = false; } else { bld.append(" "); } String esc = Strings.escape(c); // Quote where escaping is needed, OR the argument // contains a literal space. if (!c.equals(esc) || c.contains(" ")) { bld.append('\"') .append(esc) .append('\"'); } else { bld.append(c); } } throw new IOException("Process took too long: " + bld.toString()); } }
public class class_name { protected void handleProcessTimeout(String[] cmd) throws IOException { StringBuilder bld = new StringBuilder(); boolean first = true; for (String c : cmd) { if (first) { first = false; // depends on control dependency: [if], data = [none] } else { bld.append(" "); // depends on control dependency: [if], data = [none] } String esc = Strings.escape(c); // Quote where escaping is needed, OR the argument // contains a literal space. if (!c.equals(esc) || c.contains(" ")) { bld.append('\"') .append(esc) .append('\"'); // depends on control dependency: [if], data = [none] } else { bld.append(c); // depends on control dependency: [if], data = [none] } } throw new IOException("Process took too long: " + bld.toString()); } }
public class class_name { public void setCompatibleImages(java.util.Collection<CompatibleImage> compatibleImages) { if (compatibleImages == null) { this.compatibleImages = null; return; } this.compatibleImages = new java.util.ArrayList<CompatibleImage>(compatibleImages); } }
public class class_name { public void setCompatibleImages(java.util.Collection<CompatibleImage> compatibleImages) { if (compatibleImages == null) { this.compatibleImages = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.compatibleImages = new java.util.ArrayList<CompatibleImage>(compatibleImages); } }
public class class_name { @Override public Tile getTile(int x, int y, int zoom) { Tile tile = null; // Check if there is a tile if (hasTile(x, y, zoom)) { // Retrieve the tile tile = retrieveTile(x, y, zoom); } return tile; } }
public class class_name { @Override public Tile getTile(int x, int y, int zoom) { Tile tile = null; // Check if there is a tile if (hasTile(x, y, zoom)) { // Retrieve the tile tile = retrieveTile(x, y, zoom); // depends on control dependency: [if], data = [none] } return tile; } }
public class class_name { public void marshall(DescribeTransformJobRequest describeTransformJobRequest, ProtocolMarshaller protocolMarshaller) { if (describeTransformJobRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeTransformJobRequest.getTransformJobName(), TRANSFORMJOBNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeTransformJobRequest describeTransformJobRequest, ProtocolMarshaller protocolMarshaller) { if (describeTransformJobRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeTransformJobRequest.getTransformJobName(), TRANSFORMJOBNAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected GVRPickedObject findCollider(GVRPickedObject[] pickList, GVRCollider findme) { if (pickList == null) { return null; } for (GVRPickedObject hit : pickList) { if ((hit != null) && (hit.hitCollider == findme)) { return hit; } } return null; } }
public class class_name { protected GVRPickedObject findCollider(GVRPickedObject[] pickList, GVRCollider findme) { if (pickList == null) { return null; // depends on control dependency: [if], data = [none] } for (GVRPickedObject hit : pickList) { if ((hit != null) && (hit.hitCollider == findme)) { return hit; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @Override public void config(String msg) { if (isLoggable(Level.CONFIG)) { log(Level.CONFIG, msg); } } }
public class class_name { @Override public void config(String msg) { if (isLoggable(Level.CONFIG)) { log(Level.CONFIG, msg); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean isAssignable(Class<?> lhsType, Class<?> rhsType) { Assert.notNull(lhsType, "Left-hand side type must not be null"); Assert.notNull(rhsType, "Right-hand side type must not be null"); if (lhsType.isAssignableFrom(rhsType)) { return true; } if (lhsType.isPrimitive()) { Class<?> resolvedPrimitive = primitiveWrapperTypeMap.get(rhsType); if (lhsType == resolvedPrimitive) { return true; } } else { Class<?> resolvedWrapper = primitiveTypeToWrapperMap.get(rhsType); if (resolvedWrapper != null && lhsType.isAssignableFrom(resolvedWrapper)) { return true; } } return false; } }
public class class_name { public static boolean isAssignable(Class<?> lhsType, Class<?> rhsType) { Assert.notNull(lhsType, "Left-hand side type must not be null"); Assert.notNull(rhsType, "Right-hand side type must not be null"); if (lhsType.isAssignableFrom(rhsType)) { return true; // depends on control dependency: [if], data = [none] } if (lhsType.isPrimitive()) { Class<?> resolvedPrimitive = primitiveWrapperTypeMap.get(rhsType); if (lhsType == resolvedPrimitive) { return true; // depends on control dependency: [if], data = [none] } } else { Class<?> resolvedWrapper = primitiveTypeToWrapperMap.get(rhsType); if (resolvedWrapper != null && lhsType.isAssignableFrom(resolvedWrapper)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public static String decode(String uri) { if(logger.isDebugEnabled()) { logger.debug("uri to decode " + uri); } if(uri == null) { // fix by Hauke D. Issue 410 // throw new NullPointerException("uri cannot be null !"); return null; } //optimization for uri with no escaped chars //fixes https://github.com/RestComm/sip-servlets/issues/124 if (uri.indexOf(UTF8_ESCAPE_CHAR) < 0) { return uri; } StringBuffer translatedUri = new StringBuffer(uri.length()); byte[] encodedchars = new byte[uri.length() / 3]; int i = 0; int length = uri.length(); int encodedcharsLength = 0; while (i < length) { if (uri.charAt(i) == UTF8_ESCAPE_CHAR) { //we must process all consecutive %-encoded characters in one go, because they represent //an UTF-8 encoded string, and in UTF-8 one character can be encoded as multiple bytes while (i < length && uri.charAt(i) == UTF8_ESCAPE_CHAR) { if (i + 2 < length) { try { byte x = (byte)Integer.parseInt(uri.substring(i + 1, i + 3), 16); encodedchars[encodedcharsLength] = x; } catch (NumberFormatException e) { // do not throw exception, a % could be part of a IPv6 address and still be valid // throw new IllegalArgumentException("Illegal hex characters in pattern %" + uri.substring(i + 1, i + 3)); } encodedcharsLength++; i += 3; } else { // do not throw exception, a % could be part of a IPv6 address and still be valid // throw new IllegalArgumentException("% character should be followed by 2 hexadecimal characters."); } } try { String translatedPart = new String(encodedchars, 0, encodedcharsLength, UTF_8); translatedUri.append(translatedPart); } catch (UnsupportedEncodingException e) { //the situation that UTF-8 is not supported is quite theoretical, so throw a runtime exception throw new IllegalArgumentException("Problem in decodePath: UTF-8 encoding not supported."); } encodedcharsLength = 0; } else { //a normal character translatedUri.append(uri.charAt(i)); i++; } } if(logger.isDebugEnabled()) { logger.debug("decoded uri " + translatedUri); } return translatedUri.toString(); } }
public class class_name { public static String decode(String uri) { if(logger.isDebugEnabled()) { logger.debug("uri to decode " + uri); // depends on control dependency: [if], data = [none] } if(uri == null) { // fix by Hauke D. Issue 410 // throw new NullPointerException("uri cannot be null !"); return null; // depends on control dependency: [if], data = [none] } //optimization for uri with no escaped chars //fixes https://github.com/RestComm/sip-servlets/issues/124 if (uri.indexOf(UTF8_ESCAPE_CHAR) < 0) { return uri; // depends on control dependency: [if], data = [none] } StringBuffer translatedUri = new StringBuffer(uri.length()); byte[] encodedchars = new byte[uri.length() / 3]; int i = 0; int length = uri.length(); int encodedcharsLength = 0; while (i < length) { if (uri.charAt(i) == UTF8_ESCAPE_CHAR) { //we must process all consecutive %-encoded characters in one go, because they represent //an UTF-8 encoded string, and in UTF-8 one character can be encoded as multiple bytes while (i < length && uri.charAt(i) == UTF8_ESCAPE_CHAR) { if (i + 2 < length) { try { byte x = (byte)Integer.parseInt(uri.substring(i + 1, i + 3), 16); encodedchars[encodedcharsLength] = x; // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { // do not throw exception, a % could be part of a IPv6 address and still be valid // throw new IllegalArgumentException("Illegal hex characters in pattern %" + uri.substring(i + 1, i + 3)); } // depends on control dependency: [catch], data = [none] encodedcharsLength++; // depends on control dependency: [if], data = [none] i += 3; // depends on control dependency: [if], data = [none] } else { // do not throw exception, a % could be part of a IPv6 address and still be valid // throw new IllegalArgumentException("% character should be followed by 2 hexadecimal characters."); } } try { String translatedPart = new String(encodedchars, 0, encodedcharsLength, UTF_8); translatedUri.append(translatedPart); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { //the situation that UTF-8 is not supported is quite theoretical, so throw a runtime exception throw new IllegalArgumentException("Problem in decodePath: UTF-8 encoding not supported."); } // depends on control dependency: [catch], data = [none] encodedcharsLength = 0; // depends on control dependency: [if], data = [none] } else { //a normal character translatedUri.append(uri.charAt(i)); // depends on control dependency: [if], data = [(uri.charAt(i)] i++; // depends on control dependency: [if], data = [none] } } if(logger.isDebugEnabled()) { logger.debug("decoded uri " + translatedUri); // depends on control dependency: [if], data = [none] } return translatedUri.toString(); } }