athibanraj / gdata-java-client

Automatically exported from code.google.com/p/gdata-java-client
Apache License 2.0
0 stars 0 forks source link

yt:display xml attribute inserted in media:credit tag causing parse failures. #416

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Follow the instructions on running the sample code for youtube data api 
access. gdata-samples.java-1.47.1.zip
2. The standardfeeds crashes. (Option 1)

What is the expected output? What do you see instead?
I see that the media:credit xml tags have a yt:display attribute in them. And 
this causes the parser to crash. I am not sure if this is the core problem but 
couldn't find any help on the internet.

<media:credit role='uploader' scheme='urn:youtube' yt:display='nabin 
gurung'>nabin1227</media:credit>

What version of the product are you using? On what operating system?
Latest release 1.47.1

Please provide any additional information below.
com.google.gdata.util.ParseException: [Line 1, Column 5271, element 
media:credit] Unknown attribute: 'display' 
    at com.google.gdata.util.XmlParser.throwParseException(XmlParser.java:722)
    at com.google.gdata.util.XmlParser.parse(XmlParser.java:685)
    at com.google.gdata.util.XmlParser.parse(XmlParser.java:568)
    at com.google.gdata.data.BaseFeed.parseAtom(BaseFeed.java:838)
    at com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java:68)
    at com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java:39)
    at com.google.gdata.wireformats.input.CharacterParser.parse(CharacterParser.java:100)
    at com.google.gdata.wireformats.input.XmlInputParser.parse(XmlInputParser.java:52)
    at com.google.gdata.wireformats.input.AtomDualParser.parse(AtomDualParser.java:66)
    at com.google.gdata.wireformats.input.AtomDualParser.parse(AtomDualParser.java:34)
    at com.google.gdata.client.Service.parseResponseData(Service.java:1896)
    at com.google.gdata.client.Service.getFeed(Service.java:1054)
    at com.google.gdata.client.Service.getFeed(Service.java:916)
    at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:631)
    at com.google.gdata.client.Service.getFeed(Service.java:935)
    at com.java.appengine.projects.videotrends.YouTubeReadonlyClient.printVideoFeed(YouTubeReadonlyClient.java:529)
    at com.java.appengine.projects.videotrends.YouTubeReadonlyClient.printStandardFeeds(YouTubeReadonlyClient.java:149)
    at com.java.appengine.projects.videotrends.YouTubeReadonlyClient.main(YouTubeReadonlyClient.java:720)

Original issue reported on code.google.com by avi.du...@gmail.com on 25 Nov 2012 at 3:13

GoogleCodeExporter commented 9 years ago
Hi,
I am getting same exception thoough my video get uploaded successfully...can 
anybody tell why this exception occur? I am using gdata-youtube-2.0.jar

below is my code...

File videoFile = new File(videoFilename);
        if (!videoFile.exists() || !videoFile.isFile() || !videoFile.canRead()) {
            throw new IOException("File '" + videoFilename + "' must be an existing reabable file in order to upload to YouTube!");
        }
        VideoEntry newEntry = new VideoEntry();

        YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();

        mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Tech"));
        mg.setTitle(new MediaTitle());
        mg.getTitle().setPlainTextContent(videoTitle);
        mg.setKeywords(new MediaKeywords());
        mg.getKeywords().addKeyword("gdata-test");
        mg.setDescription(new MediaDescription());
        mg.getDescription().setPlainTextContent(videoTitle);
        MediaFileSource ms = new MediaFileSource(videoFile, mimeType);
        newEntry.setMediaSource(ms);

        try {
          service.insert(new URL(VIDEO_UPLOAD_FEED), newEntry);
        } catch (ServiceException se) {
          System.out.println("Sorry, your upload was invalid:");
          System.out.println(se.getResponseBody());
          throw new MioException("Failed to upload video: " + videoFilename, se);
        }

Original comment by mioevery...@gmail.com on 18 Mar 2013 at 7:39