• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java InvalidReferenceException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.javarosa.core.reference.InvalidReferenceException的典型用法代码示例。如果您正苦于以下问题:Java InvalidReferenceException类的具体用法?Java InvalidReferenceException怎么用?Java InvalidReferenceException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InvalidReferenceException类属于org.javarosa.core.reference包,在下文中一共展示了InvalidReferenceException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: queueError

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
private void queueError(String title, String msg, String image, String audio) {
        alertTitle = title;
        this.msg = msg;

        //Try to load the image
        this.alertImage = null;
        if(image != null) {
            try {
                Reference ref = ReferenceManager._().DeriveReference(image);
                InputStream in = ref.getStream();
                this.alertImage = Image.createImage(in);
                in.close();
            } catch (IOException e) {
                Logger.exception(e);
            } catch(InvalidReferenceException ire) {
                Logger.exception(ire);
            }
        }

        //Try to load the image
        this.audioURI = audio;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:23,代码来源:Chatterbox.java


示例2: addDerivedLocation

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
/**
 * Derive a reference from the given location and context; adding it to the
 * vector of references.
 *
 * @param location Contains a reference to a resource.
 * @param context  Provides context for any relative reference accessors.
 *                 Can be null.
 * @param ret      Add derived reference of location to this Vector.
 */
private static void addDerivedLocation(ResourceLocation location,
                                       Reference context,
                                       Vector<Reference> ret) {
    try {
        final Reference derivedRef;
        if (context == null) {
            derivedRef =
                    ReferenceManager._().DeriveReference(location.getLocation());
        } else {
            // contextualize the location ref in terms of the multiple refs
            // pointing to different locations for the parent resource
            derivedRef =
                    ReferenceManager._().DeriveReference(location.getLocation(),
                            context);
        }
        ret.addElement(derivedRef);
    } catch (InvalidReferenceException e) {
        e.printStackTrace();
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:30,代码来源:ResourceTable.java


示例3: getAudioFilename

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
/**
 * Gets the audio source filename from the URI.
 *
 * @return Filepath of audio source stored in local URI. Returns an empty
 * string if no audio source is found.
 */
private String getAudioFilename(String URI) throws IOException {
    if (URI == null) {
        throw new IOException("No audio file was specified");
    }

    String audioFilename;
    try {
        audioFilename =
                ReferenceManager.instance().DeriveReference(URI).getLocalURI();
    } catch (InvalidReferenceException e) {
        throw new IOException(e);
    }

    File audioFile = new File(audioFilename);
    if (!audioFile.exists()) {
        throw new IOException("File missing: " + audioFilename);
    }
    return audioFilename;
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:26,代码来源:MediaEntity.java


示例4: setReadyToInstall

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
private void setReadyToInstall(String reference) {
    incomingRef = reference;
    this.uiState = UiState.READY_TO_INSTALL;

    try {
        ReferenceManager.instance().DeriveReference(incomingRef);
        if (lastInstallMode == INSTALL_MODE_OFFLINE || lastInstallMode == INSTALL_MODE_FROM_LIST) {
            onStartInstallClicked();
        } else {
            uiStateScreenTransition();
        }
    } catch (InvalidReferenceException ire) {
        incomingRef = null;
        fail(Localization.get("install.bad.ref"));
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:17,代码来源:CommCareSetupActivity.java


示例5: performLocalRestore

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
public <I extends CommCareActivity & PullTaskResultReceiver> void performLocalRestore(
        I context,
        String username,
        String password) {

    try {
        ReferenceManager.instance().DeriveReference(
                SingleAppInstallation.LOCAL_RESTORE_REFERENCE).getStream();
    } catch (InvalidReferenceException | IOException e) {
        throw new RuntimeException("Local restore file missing");
    }

    LocalReferencePullResponseFactory.setRequestPayloads(new String[]{SingleAppInstallation.LOCAL_RESTORE_REFERENCE});
    syncData(context, false, false, "fake-server-that-is-never-used", username, password, "unused",
            LocalReferencePullResponseFactory.INSTANCE, true);
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:17,代码来源:FormAndDataSyncer.java


示例6: onItemLongClick

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view,
        int position, long id) {
    MenuDisplayable value = (MenuDisplayable)parent.getAdapter().getItem(position);
    String audioURI = value.getAudioURI();
    MediaPlayer mp = new MediaPlayer();
    String audioFilename;
    if (audioURI != null && !audioURI.equals("")) {
        try {
            audioFilename = ReferenceManager.instance().DeriveReference(audioURI).getLocalURI();
            mp.setDataSource(audioFilename);
            mp.prepare();
            mp.start();
        } catch (IOException | IllegalStateException
                | InvalidReferenceException e) {
            e.printStackTrace();
        }
    }
    return false;
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:21,代码来源:MenuGrid.java


示例7: initializeFileRoots

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
private void initializeFileRoots() {
    synchronized (lock) {
        String root = storageRoot();
        fileRoot = new JavaFileRoot(root);

        String testFileRoot = "jr://file/mytest.file";
        // Assertion: There should be _no_ other file roots when we initialize
        try {
            String testFilePath = ReferenceManager.instance().DeriveReference(testFileRoot).getLocalURI();
            String message = "Cannot setup sandbox. An Existing file root is set up, which directs to: " + testFilePath;
            Logger.log(LogTypes.TYPE_ERROR_DESIGN, message);
            throw new IllegalStateException(message);
        } catch (InvalidReferenceException ire) {
            // Expected.
        }


        ReferenceManager.instance().addReferenceFactory(fileRoot);

        // Double check that things point to the right place?
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:23,代码来源:CommCareApp.java


示例8: setupAudioButton

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
private void setupAudioButton(int rowId, AudioPlaybackButton audioPlaybackButton, MenuDisplayable menuDisplayable) {
    if (audioPlaybackButton != null) {
        final String audioURI = menuDisplayable.getAudioURI();
        String audioFilename = "";
        if (audioURI != null && !audioURI.equals("")) {
            try {
                audioFilename = ReferenceManager.instance().DeriveReference(audioURI).getLocalURI();
            } catch (InvalidReferenceException e) {
                Log.e("AVTLayout", "Invalid reference exception");
                e.printStackTrace();
            }
        }

        File audioFile = new File(audioFilename);
        // First set up the audio button
        ViewId viewId = ViewId.buildListViewId(rowId);
        if (!"".equals(audioFilename) && audioFile.exists()) {
            audioPlaybackButton.modifyButtonForNewView(viewId, audioURI, true);
        } else {
            audioPlaybackButton.modifyButtonForNewView(viewId, audioURI, false);
        }
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:24,代码来源:MenuAdapter.java


示例9: removeAttachment

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
@Override
protected void removeAttachment(Case caseForBlock, String attachmentName) {
    if (!processAttachments) {
        return;
    }

    //TODO: All of this code should really be somewhere else, too, since we also need to remove attachments on
    //purge.
    String source = caseForBlock.getAttachmentSource(attachmentName);

    //TODO: Handle remote reference download?
    if (source == null) {
        return;
    }

    //Handle these cases better later.
    try {
        ReferenceManager.instance().DeriveReference(source).remove();
    } catch (InvalidReferenceException | IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:23,代码来源:AndroidCaseXmlParser.java


示例10: updateFilePath

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
/**
 * At some point hopefully soon we're not going to be shuffling our xforms around like crazy, so updates will mostly involve
 * just changing where the provider points.
 */
private boolean updateFilePath() {
    String localRawUri;
    try {
        localRawUri = ReferenceManager.instance().DeriveReference(this.localLocation).getLocalURI();
    } catch (InvalidReferenceException e) {
        Logger.log(LogTypes.TYPE_RESOURCES, "Installed resource wasn't able to be derived from " + localLocation);
        return false;
    }

    //We're maintaining this whole Content setup now, so we've goota update things when we move them.
    ContentResolver cr = CommCareApplication.instance().getContentResolver();

    ContentValues cv = new ContentValues();
    cv.put(FormsProviderAPI.FormsColumns.FORM_FILE_PATH, new File(localRawUri).getAbsolutePath());

    //Update the form file path
    int updatedRows = cr.update(Uri.parse(this.contentUri), cv, null, null);
    if (updatedRows > 1) {
        throw new RuntimeException("Bad URI stored for xforms installer: " + this.contentUri);
    }
    return updatedRows != 0;
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:27,代码来源:XFormAndroidInstaller.java


示例11: upgrade

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
@Override
public boolean upgrade(Resource r, AndroidCommCarePlatform platform) {
    try {
        //TODO: This process is silly! Just put the files somewhere as a resource with a unique GUID and stop shuffling them around!

        //use same filename as before
        String filepart = localLocation.substring(localLocation.lastIndexOf("/"));

        //Get final destination
        String finalLocation = localDestination + "/" + filepart;

        if (!FileSystemUtils.moveFrom(localLocation, finalLocation, false)) {
            return false;
        }

        localLocation = finalLocation;
        return true;
    } catch (InvalidReferenceException e) {
        return false;
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:22,代码来源:FileSystemInstaller.java


示例12: initialize

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
@Override
public boolean initialize(AndroidCommCarePlatform platform, boolean isUpgrade) {
    try {

        Reference local = ReferenceManager.instance().DeriveReference(localLocation);

        ProfileParser parser = new ProfileParser(local.getStream(), platform, platform.getGlobalResourceTable(), null,
                Resource.RESOURCE_STATUS_INSTALLED, false);

        Profile p = parser.parse();
        platform.setProfile(p);

        return true;
    } catch (UnfullfilledRequirementsException | XmlPullParserException
            | InvalidStructureException | IOException
            | InvalidReferenceException e) {
        e.printStackTrace();
    }

    return false;
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:22,代码来源:ProfileAndroidInstaller.java


示例13: addDerivedLocation

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
/**
 * Derive a reference from the given location and context; adding it to the
 * vector of references.
 *
 * @param location Contains a reference to a resource.
 * @param context  Provides context for any relative reference accessors.
 *                 Can be null.
 * @param ret      Add derived reference of location to this Vector.
 */
private static void addDerivedLocation(ResourceLocation location,
                                       Reference context,
                                       Vector<Reference> ret) {
    try {
        final Reference derivedRef;
        if (context == null) {
            derivedRef =
                    ReferenceManager.instance().DeriveReference(location.getLocation());
        } else {
            // contextualize the location ref in terms of the multiple refs
            // pointing to different locations for the parent resource
            derivedRef =
                    ReferenceManager.instance().DeriveReference(location.getLocation(),
                            context);
        }
        ret.addElement(derivedRef);
    } catch (InvalidReferenceException e) {
        e.printStackTrace();
    }
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:30,代码来源:ResourceTable.java


示例14: readExternal

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
    referenceName = ExtUtil.readString(in);
    try {
        ref = ReferenceManager._().DeriveReference(referenceName);
    } catch (InvalidReferenceException e) {
        throw new DeserializationException("Unsupported local reference " + e.getMessage());
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:9,代码来源:ReferenceDataPointer.java


示例15: setupVideo

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
private void setupVideo(String textField) {
    String localLocation = null;
    try {
        localLocation = ReferenceManager.instance().DeriveReference(textField).getLocalURI();
        if (localLocation.startsWith("/")) {
            //TODO: This should likely actually be happening with the getLocalURI _anyway_.
            localLocation = FileUtil.getGlobalStringUri(localLocation);
        }
    } catch (InvalidReferenceException ire) {
        Logger.log(LogTypes.TYPE_ERROR_CONFIG_STRUCTURE, "Couldn't understand video reference format: " + localLocation + ". Error: " + ire.getMessage());
    }

    final String location = localLocation;

    videoButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            listener.playVideo(location);
        }

    });

    if (location == null) {
        videoButton.setEnabled(false);
        Logger.log(LogTypes.TYPE_ERROR_CONFIG_STRUCTURE, "No local video reference available for ref: " + textField);
    } else {
        videoButton.setEnabled(true);
    }

    updateCurrentView(VIDEO, videoButton);
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:33,代码来源:EntityDetailView.java


示例16: setFullScreen

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
private void setFullScreen() {
    String imageFileURI;

    if (bigImageURI != null) {
        imageFileURI = bigImageURI;
    } else if (imageURI != null) {
        imageFileURI = imageURI;
    } else {
        return;
    }

    try {
        String imageFilename = ReferenceManager.instance()
                .DeriveReference(imageFileURI).getLocalURI();
        File bigImage = new File(imageFilename);

        Intent i = new Intent("android.intent.action.VIEW");
        Uri imageFileUri = FileUtil.getUriForExternalFile(getContext(), bigImage);
        i.setDataAndType(imageFileUri, "image/*");
        i.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

        getContext().startActivity(i);
    } catch (InvalidReferenceException e1) {
        e1.printStackTrace();
    } catch (ActivityNotFoundException e) {
        Toast.makeText(
                getContext(),
                getContext().getString(R.string.activity_not_found,
                        "view image"), Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:32,代码来源:ResizingImageView.java


示例17: LocalReferencePullResponse

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
public LocalReferencePullResponse(String xmlPayloadReference,
                                  Response response) throws IOException {
    super(null, response);

    try {
        debugStream =
                ReferenceManager.instance().DeriveReference(xmlPayloadReference).getStream();
    } catch (InvalidReferenceException ire) {
        throw new IOException("No payload available at " + xmlPayloadReference);
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:12,代码来源:LocalReferencePullResponse.java


示例18: getTemplateFilePathOrThrowError

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
/**
 * Retrieve a valid path that is the template file to be used during printing, or
 * display an error message to the user. If a message is displayed, the method will
 * return null and the activity should not continue attempting to print
 */
private String getTemplateFilePathOrThrowError(Bundle data) {
    // Check to make sure key-value data has been passed with the intent
    if (data == null) {
        showErrorDialog(Localization.get("no.print.data"));
        return null;
    }

    // Check if a doc location is coming in from the Intent
    // Will return a reference of format jr://... if it has been set
    String path = data.getString(PRINT_TEMPLATE_REF_STRING);
    if (path != null && !path.equals(Detail.PRINT_TEMPLATE_PROVIDED_VIA_GLOBAL_SETTING)) {
        try {
            path = ReferenceManager.instance().DeriveReference(path).getLocalURI();
            return path;
        } catch (InvalidReferenceException e) {
            showErrorDialog(Localization.get("template.invalid"));
            return null;
        }
    } else {
        // Try to use the document location that was set in Settings menu
        path = MainConfigurablePreferences.getGlobalTemplatePath();
        if (path == null) {
            showErrorDialog(Localization.get("missing.template.file"));
        }
        return path;
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:33,代码来源:TemplatePrinterActivity.java


示例19: derive

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
@Override
public Reference derive(String URI, String context) throws InvalidReferenceException {
    if (context.lastIndexOf('/') != -1) {
        context = context.substring(0, context.lastIndexOf('/') + 1);
    }
    return ReferenceManager.instance().DeriveReference(context + URI);
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:8,代码来源:AssetFileRoot.java


示例20: checkReferenceURI

import org.javarosa.core.reference.InvalidReferenceException; //导入依赖的package包/类
public static void checkReferenceURI(Resource r, String URI, Vector<MissingMediaException> problems) throws IOException {
    try {
        Reference mRef = ReferenceManager.instance().DeriveReference(URI);

        if (!mRef.doesBinaryExist()) {
            String mLocalReference = mRef.getLocalURI();
            problems.addElement(new MissingMediaException(r, "Missing external media: " + mLocalReference, mLocalReference));
        }

    } catch (InvalidReferenceException ire) {
        //do nothing for now
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:14,代码来源:FileUtil.java



注:本文中的org.javarosa.core.reference.InvalidReferenceException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RoundedCorners类代码示例发布时间:2022-05-22
下一篇:
Java KettleDependencyException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap