/*
合并类型声明
@throws Exception
422327
public static List<TypeDeclaration> mergeTypes(List<TypeDeclaration> one, List<TypeDeclaration> two) throws Exception {
        List<TypeDeclaration> result = new ArrayList<>();

        for (TypeDeclaration outer : one) {

            boolean found = false;
            for (TypeDeclaration inner : two) {

                if (outer.getName().equals(inner.getName())) {
                    TypeDeclaration merged = mergeType(outer, inner);
                    result.add(merged);
                    found = true;
                }
            }

            if (!found) {
                result.add(outer);
                LOG.info("add {} --> {}", outer.getClass().getSimpleName(), outer.getName());
            }
        }
        return result;
    }
563779
public final void mEXPONENT() throws RecognitionException {
        try {
            // EventFilter.g:243:10: ( ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ )
            // EventFilter.g:243:12: ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+
            {
            if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            // EventFilter.g:243:22: ( '+' | '-' )?
            int alt19=2;
            int LA19_0 = input.LA(1);

            if ( (LA19_0=='+'||LA19_0=='-') ) {
                alt19=1;
            }
            switch (alt19) {
                case 1 :
                    // EventFilter.g:
                    {
                    if ( input.LA(1)=='+'||input.LA(1)=='-' ) {
                        input.consume();
                    }
                    else {
                        MismatchedSetException mse = new MismatchedSetException(null,input);
                        recover(mse);
                        throw mse;
                    }


                    }
                    break;

            }


            // EventFilter.g:243:33: ( '0' .. '9' )+
            int cnt20=0;
            loop20:
            do {
                int alt20=2;
                int LA20_0 = input.LA(1);

                if ( ((LA20_0 >= '0' && LA20_0 <= '9')) ) {
                    alt20=1;
                }


                switch (alt20) {
            	case 1 :
            	    // EventFilter.g:
            	    {
            	    if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
            	        input.consume();
            	    }
            	    else {
            	        MismatchedSetException mse = new MismatchedSetException(null,input);
            	        recover(mse);
            	        throw mse;
            	    }


            	    }
            	    break;

            	default :
            	    if ( cnt20 >= 1 ) break loop20;
                        EarlyExitException eee =
                            new EarlyExitException(20, input);
                        throw eee;
                }
                cnt20++;
            } while (true);


            }


        }
        finally {
        	// do for sure before leaving
        }
    }
459112
private final void sign() throws Exception {
        String dataStr = this.getUserData().toString();
        byte[] data = Base64Coder.getBytes(dataStr);
        byte[] signature = sign(data, this.privateKey);
        this.setSignature(signature);
    }
604905
public void write() throws Exception {
    PrintWriter out;
    String output = output();

    if (outFile != null) {
      out = new PrintWriter(Files.newBufferedWriter(outFile.toPath(), UTF_8));
    } else if (inPlace) {
      assert docFile != null
          : "@AssumeAssertion(nullness): dependent: docFile is non-null if inPlace is true";
      out = new PrintWriter(Files.newBufferedWriter(docFile.toPath(), UTF_8));
    } else {
      out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out, UTF_8)));
    }

    out.println(output);
    out.flush();
    out.close();
  }
19148
private void sendMultipart() throws IOException {
		setMultipart();// 设置表单类型为Multipart

		final OutputStream out = this.httpConnection.getOutputStream();
		try {
			writeFileForm(out);
			writeForm(out);
			formEnd(out);
		} catch (IOException e) {
			throw e;
		} finally {
			IoUtil.close(out);
		}
	}
1077997
@Execute
    public void process() throws Exception {
        if (!concatOr(outPit == null, doReset)) {
            return;
        }
        checkNull(inElev);
        HashMap<String, Double> regionMap = CoverageUtilities.getRegionParamsFromGridCoverage(inElev);
        nCols = regionMap.get(CoverageUtilities.COLS).intValue();
        nRows = regionMap.get(CoverageUtilities.ROWS).intValue();
        xRes = regionMap.get(CoverageUtilities.XRES);
        yRes = regionMap.get(CoverageUtilities.YRES);

        elevationIter = CoverageUtilities.getRandomIterator(inElev);

        // output raster
        WritableRaster pitRaster = CoverageUtilities.createWritableRaster(nCols, nRows, null, null, null);
        pitIter = CoverageUtilities.getWritableRandomIterator(pitRaster);

        for( int i = 0; i < nRows; i++ ) {
            if (pm.isCanceled()) {
                return;
            }
            for( int j = 0; j < nCols; j++ ) {
                double value = elevationIter.getSampleDouble(j, i, 0);
                if (!isNovalue(value)) {
                    pitIter.setSample(j, i, 0, value);
                } else {
                    pitIter.setSample(j, i, 0, PITNOVALUE);
                }
            }
        }

        flood();
        if (pm.isCanceled()) {
            return;
        }

        for( int i = 0; i < nRows; i++ ) {
            if (pm.isCanceled()) {
                return;
            }
            for( int j = 0; j < nCols; j++ ) {
                if (dir[j][i] == 0) {
                    return;
                }
                double value = pitIter.getSampleDouble(j, i, 0);
                if (value == PITNOVALUE || isNovalue(value)) {
                    pitIter.setSample(j, i, 0, doubleNovalue);
                }
            }
        }
        pitIter.done();

        outPit = CoverageUtilities.buildCoverage("pitfiller", pitRaster, regionMap, inElev.getCoordinateReferenceSystem());
    }
1005550
public function flush()
    {
        if (false !== $many = $this->put($this->_stringBuffer, FILE_APPEND)) {
            $this->_stringBuffer = "";
            return $many;
        }
        throw new Exception("文件写入失败+", 100100302);
    }
323835
@Setup
    public void setUp() throws Exception {
        ClassByExtensionBenchmark classByExtensionBenchmark = new ClassByExtensionBenchmark();
        baselineInstance = classByExtensionBenchmark.baseline();
        byteBuddyWithProxyInstance = classByExtensionBenchmark.benchmarkByteBuddyWithProxy();
        byteBuddyWithAccessorInstance = classByExtensionBenchmark.benchmarkByteBuddyWithAccessor();
        byteBuddyWithPrefixInstance = classByExtensionBenchmark.benchmarkByteBuddyWithPrefix();
        byteBuddySpecializedInstance = classByExtensionBenchmark.benchmarkByteBuddySpecialized();
        cglibInstance = classByExtensionBenchmark.benchmarkCglib();
        javassistInstance = classByExtensionBenchmark.benchmarkJavassist();
    }
582486
public function buildForReply()
    {
        if (!method_exists($this, 'toReply')) {
            throw new \Exception(__CLASS__.'未实现此方法：toReply()');
        }

        $base = array(
                 'ToUserName'   => $this->to,
                 'FromUserName' => $this->from,
                 'CreateTime'   => time(),
                 'MsgType'      => $this->getDefaultMessageType(),
                );

        return XML::build(array_merge($base, $this->toReply()));
    }
1372361
public void commit() throws SQLException {
		try {
			getConnection().commit();
		} catch (SQLException e) {
			throw e;
		} finally {
			try {
				getConnection().setAutoCommit(true); // 事务结束，恢复自动提交
			} catch (SQLException e) {
				log.error(e);
			}
		}
	}
225709
public static String mergeContent(String one, String two) throws Exception {
        return mergeContent(generateAst(one), generateAst(two));
    }
771570
public void commit() throws Exception {
        final Map<String, Object> params = new HashMap<String, Object>();

        final String applicationId = getPropertyAsString("applicationId");
        if (applicationId != null) params.put("applicationId", applicationId);

        final String name = getName();
        if (name != null) params.put("name", name);

        final String fallbackNumber = getFallbackNumber();
        if (fallbackNumber != null) params.put("fallbackNumber", fallbackNumber);

        final String uri = getUri();
        client.post(uri, params);

        final JSONObject object = toJSONObject(client.get(uri, null));
        updateProperties(object);
    }
801527
public URI call() throws Exception {
		// Save original time stamp for dependency list
		long lastModifiedDep = treeNode.lastModifiedDep();
		long lastModified = resource.lastModified();
		// Parse the javascript code
		Compiler compiler = new Compiler();
		CompilerOptions options = CompilerUtil.getDefaultOptions();
		if (compilerOptionsMap != null) {
			CompilerUtil.applyCompilerOptionsFromMap(options, compilerOptionsMap);
		}
		options.setWarningLevel(DiagnosticGroups.NON_STANDARD_JSDOC,
				CheckLevel.OFF);

		compiler.initOptions(options);
		InputStream in = resource.getInputStream();
		Node node = null;
		try {
			node = compiler.parse(JSSourceFile.fromInputStream(resource.getURI().toString(), in));
			if (compiler.hasErrors()) {
				if (log.isLoggable(Level.WARNING)) {
					JSError[] errors = compiler.getErrors();
					for (JSError error : errors) {
						log.log(Level.WARNING, error.toString());
					}
				}
			}
		} catch (Throwable e) {
			if (log.isLoggable(Level.WARNING)) {
				log.log(Level.WARNING, "Error occurred parsing " + resource.getURI().toString() + ": " + e.getMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$
			}
		} finally {
			in.close();
		}
		if (node != null) {
			// walk the AST for the node looking for define calls
			// and pull out the required dependency list.
			Set<String> features = new HashSet<String>();
			ParseResult parseResult = DepUtils.parseDependencies(node, features);
			Collection<String> defineDeps = parseResult.getDefineDependencies();
			Collection<String> requireDeps = parseResult.getRequireDependencies();
			String[] defineDepArray = (defineDeps == null) ?
					new String[0] : defineDeps.toArray(new String[defineDeps.size()]);
			String[] requireDepArray = (requireDeps == null) ?
					new String[0] : requireDeps.toArray(new String[requireDeps.size()]);
			String[] featureArray = (features == null) ?
					new String[0] : features.toArray(new String[features.size()]);
			/*
			 * Determine if the dependency list has changed.  We keep track of
			 * dependency list changes separate from code changes in general
			 * because a dependency list change necessitates invalidating all
			 * cached responses for the configs that reference this file, and
			 * we want to do this only when necessary.
			 */
			if (lastModifiedDep ==  -1 ||
					!Arrays.equals(defineDepArray, treeNode.getDefineDepArray()) ||
					!Arrays.equals(requireDepArray, treeNode.getRequireDepArray()) ||
					!Arrays.equals(featureArray, treeNode.getDependentFeatures())) {
				lastModifiedDep = lastModified;
			}
			// update the dependency info in the node
			treeNode.setDependencies(defineDepArray, requireDepArray, featureArray,
					lastModified, lastModifiedDep);
		}
		return resource.getURI();
	}
510756
protected void mergeExistedElement(XmlElement src, XmlElement dest) {

    // 合并属性
    List<Attribute> srcAttributes = src.getAttributes();
    List<Attribute> destAttributes = dest.getAttributes();
    for (Attribute srcAttr : srcAttributes) {
      Attribute matched = null;
      for (Attribute destAttr : destAttributes) {
        if (StringUtils.equals(srcAttr.getName(), destAttr.getName()) &&
            StringUtils.equals(srcAttr.getValue(), destAttr.getValue())) {
          matched = destAttr;
        }
      }
      // 不存在则添加到目标元素的属性列表中
      if (matched == null) {
        destAttributes.add(srcAttributes.indexOf(srcAttr), srcAttr);
      }
    }

    // 重组子节点
    // reformationTheElementChilds(src);
    // reformationTheElementChilds(dest);

    // 暂时不做处理 ---留待后续添加
  }
533206
public function callback() {
        $xml = app('request')->input();
        if (empty($xml)) {
            throw new Exception(
                __('xml error')
            );
        }
        /**
         * 禁止引用外部xml实体
         */
        $disableLibxmlEntityLoader = libxml_disable_entity_loader(true);
        $args = Xml::specialDecode($xml);
        libxml_disable_entity_loader($disableLibxmlEntityLoader);
        Factory::log()
            ->info('WECHAT PAY CALLBACK: '.app('request')->input());
        if (!is_array($args)) {
            throw new Exception(
                __('xml error')
            );
        }
        if ($args['return_code'] != 'SUCCESS') {
            throw new Exception($args['return_msg']);
        }
        if (!$this->verify($args)) {
            throw new Exception(
                __('verify sign error')
            );
        }
        return $args;
    }
906610
public void SFFS() throws Exception {
		int NumTemplate = Templates.length;
		CurSet = new boolean[NumTemplate];
		LeftSet = new boolean[NumTemplate];
		for (int i = 0; i < NumTemplate; i++) {
			CurSet[i] = false;
			LeftSet[i] = true;
		}
		Evaluate(Templates, CurSet);
		boolean continueDelete = false;
		while (SetSize(CurSet) <= NumTemplate) {
			if (!continueDelete) {
				Integer theInt = BooleanSet2Integer(CurSet);
				int best = BestFeatureByAdding(CurSet, LeftSet);
				if (best != -1) {
					System.out.println("Add Best " + best);
					AlreadyAdded.add(theInt);
					CurSet[best] = true;
					LeftSet[best] = false;
					printAccuracy(CurSet);
				}
			}
			Integer theInt = BooleanSet2Integer(CurSet);
			// 被删除过的集合就不再删除了
			if (AlreadyRemoved.contains(theInt)) {
				continueDelete = false;
				continue;
			} else {
				int worst = WorstFeatureByRemoving(CurSet);
				boolean[] TestSet = CurSet.clone();
				TestSet[worst] = false;
				double accuracy = Evaluate(Templates, TestSet);
				if (accuracy >= AccuracyRecords.get(theInt)) {
					System.out.println("Remove Worst " + worst);
					AlreadyRemoved.add(theInt);
					CurSet[worst] = false;
					LeftSet[worst] = true;
					printAccuracy(CurSet);
					if (SetSize(CurSet) == 0) {
						continueDelete = false;
					} else
						continueDelete = true;
				} else {
					continueDelete = false;
					continue;
				}
			}
		}
		printAccuracyRecords(AccuracyRecords);
		ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(
				"/home/zliu/corpus/testTemplate/SFFS.ser"));
		oos.writeObject(AccuracyRecords);
		oos.close();

	}
989952
@Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {

        // 为了做兼容
        DisconfCenterHostFilesStore.getInstance().addJustHostFileSet(fileList);

        List<String> scanPackList = StringUtil.parseStringToStringList(scanPackage, SCAN_SPLIT_TOKEN);
        // unique
        Set<String> hs = new HashSet<String>();
        hs.addAll(scanPackList);
        scanPackList.clear();
        scanPackList.addAll(hs);

        // 进行扫描
        DisconfMgr.getInstance().setApplicationContext(applicationContext);
        DisconfMgr.getInstance().firstScan(scanPackList);

        // register java bean
        registerAspect(registry);
    }